druc/person-name
Composer 安装命令:
composer require druc/person-name
包简介
Presents one's name in various formats
关键字:
README 文档
README
PHP package to present one's name in various formats (doesn't include titulations).
Install
Via Composer
$ composer require druc/person-name
Usage
<?php // Create instance $name = PersonName::make('Constantin Druc'); // Get full name $name->full; // Constantin Druc // Get first name $name->first; // Constantin // Get last name $name->last; // Druc // Get name initials $name->initials; // CD // Get familiar name $name->familiar; // Constantin D. // Get abbreviated name $name->abbreviated; // C. Druc // Get sorted name $name->sorted; // Druc, Constantin // Get mentionable name $name->mentionable; // constantind // Get possessive name $name->possessive; // Constantin Druc's
Laravel usage
Initially I wanted to build a Laravel-only package but thinking about it, you can always use an accessor like this:
<?php // in App/User.php public function getNameAttribute() { return PersonName::make($this->attributes['name']); } // Somewhere in your app $user->name->familiar;
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email druc@pinsmile.com instead of using the issue tracker.
Credits
- Constantin Druc
- Basecamp's rails version - basecamp/name_of_person
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 55
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-09-04