https://github.com/ericmakesstuff/display-name
Simple package to show user's real names in a variety of Web-safe ways, i.e. Eric B. or E B. Also includes a Laravel Facade.
https://github.com/ericmakesstuff/display-name
Last synced: 9 months ago
JSON representation
Simple package to show user's real names in a variety of Web-safe ways, i.e. Eric B. or E B. Also includes a Laravel Facade.
- Host: GitHub
- URL: https://github.com/ericmakesstuff/display-name
- Owner: ericmakesstuff
- License: mit
- Created: 2015-05-17T19:11:37.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-18T02:32:10.000Z (over 10 years ago)
- Last Synced: 2024-04-30T00:01:45.232Z (almost 2 years ago)
- Language: PHP
- Homepage:
- Size: 148 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# DisplayName
[](https://github.com/ericmakesstuff/display-name/releases)
[](LICENSE.md)
[](https://travis-ci.org/ericmakesstuff/display-name)
[](https://scrutinizer-ci.com/g/ericmakesstuff/display-name/code-structure)
[](https://scrutinizer-ci.com/g/ericmakesstuff/display-name)
[](https://packagist.org/packages/ericmakesstuff/display-name)
A simple package to show user's real names in a variety of Web-safe ways, i.e. Eric B. or E B. Also includes a Laravel Facade.
## Install
Via Composer
``` bash
$ composer require ericmakesstuff/display-name
```
## Usage
``` php
$displayName = new EricMakesStuff\DisplayName\DisplayName();
echo $displayName->fullName('John Smith'); // John Smith
echo $displayName->firstName('John Smith'); // John
echo $displayName->firstNameLastInitial('John Smith'); // John S
echo $displayName->firstNameLastInitialWithPeriod('John Smith'); // John S.
echo $displayName->initials('John Smith'); // JS
echo $displayName->initialsWithPeriods('John Smith'); // J.S.
echo $displayName->initialsWithSpaces('John Smith'); // J S
echo $displayName->format('John Smith', 'initials'); // JS
```
## Laravel Facade
Include the Service Provider in config/app.php
```php
'EricMakesStuff\DisplayName\DisplayNameServiceProvider',
```
Include the Facade in config/app.php
```php
'DisplayName' => 'EricMakesStuff\DisplayName\Facades\DisplayName',
```
Use the facade
```php
DisplayName::firstName('John Smith') // John
DisplayName::format('John Smith', 'initials') // JS
```
## Change log
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Testing
``` bash
$ composer test
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security
If you discover any security related issues, please email eric at ericmakesstuff dot com instead of using the issue tracker.
## Credits
- [Eric Blount](https://github.com/eblount)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.