Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smhg/salutation-php
Salutation generator
https://github.com/smhg/salutation-php
Last synced: about 2 months ago
JSON representation
Salutation generator
- Host: GitHub
- URL: https://github.com/smhg/salutation-php
- Owner: smhg
- License: mit
- Created: 2015-04-14T10:14:07.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-12-13T11:46:28.000Z (about 8 years ago)
- Last Synced: 2024-11-10T18:58:31.316Z (2 months ago)
- Language: PHP
- Size: 8.79 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
salutation [![Build status](https://api.travis-ci.org/smhg/salutation-php.png)](https://travis-ci.org/smhg/salutation-php)
=============
Generates a salutation based on predefined formats.## Use case
In e-mails, dashboards and others, you often want to start with a personalised greeting. This might be to multiple people, of which you might have complete, partial or no names available. Some might have titles which are to be used when adressing them. And things might differ across locales.As an example, you might need to greet a list of 3 users: one is a regular person (Joe Bloggs), one is a company without a contact's name (ACME) and one a physician/doctor (Jane Smith).
First name concatenation would lead to:
```
Dear Joe, , Jane,
```
While what you want is:
```
Dear Joe, Dr. Smith,
```## Installation
```bash
composer require smhg/salutation
```## Usage
```php
use Salutation;$salutation = new Salutation('nl_BE', array(
array(
'first' => 'Jan',
'last' => 'Jansens'
),
array(
'title' => 'Dr.',
'first' => 'Peter',
'last' => 'Peters'
)
));echo $salutation;
// Beste Jan, Dr. Peters,
```## Features
* Locale aware formatting
* Title based formatting
* Nameless greeting