定制 imliam/php-name-of-person 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

imliam/php-name-of-person

Composer 安装命令:

composer require imliam/php-name-of-person

包简介

Present names for English-language applications.

README 文档

README

Latest Version on Packagist Build Status Code Quality Code Coverage Total Downloads License

Present names for English-language applications where a first and last name combined is sufficient. This approach does not cover all possible naming cases, deal with other languages or titles.

This is a rough port of the Ruby package of the same name from Basecamp.

💾 Installation

You can install the package with Composer using the following command:

composer require imliam/php-name-of-person:^1.1

📝 Usage

The package supplies a single class that can be instantiated with a string containing the original name of a person.

The class has a handful of methods that can be called to return different variations of the supplied name.

use ImLiam\NameOfPerson\Name;

$name = new Name('David Heinemeier Hansson');

$name->getFullName();       // "David Heinemeier Hansson"
$name->getFirstName();      // "David"
$name->getLastName();       // "Heinemeier Hansson"
$name->getInitials();       // "DHH"
$name->getInitials(true);   // "D.H.H."
$name->getFamiliar();       // "David H."
$name->getAbbreviated();    // "D. Heinemeier Hansson"
$name->getSorted();         // "Heinemeier Hansson, David"
$name->getMentionable();    // "davidh"
$name->getPossessive();     // "David Heinemeier Hansson's"
$name->getProperName();     // "David Heinemeier Hansson"

These methods take care to handle some of the situations that are often awkward to process and missed when handling names that come from user-input so aren't always reliable.

One such example is that names with particles can be capitalised properly with the getProperName() method.

(new Name("lucas l'amour"))->getProperName(); // "Lucas l'Amour"
(new Name('t. von lieres und wilkau'))->getProperName(); // "T. von Lieres und Wilkau"

✅ Testing

composer test

🔖 Changelog

Please see the changelog file for more information on what has changed recently.

⬆️ Upgrading

Please see the upgrading file for details on upgrading from previous versions.

🎉 Contributing

Please see the contributing file and code of conduct for details on contributing to the project.

🔒 Security

If you discover any security related issues, please email liam@liamhammett.com instead of using the issue tracker.

👷 Credits

♻️ License

The MIT License (MIT). Please see the license file for more information.

统计信息

  • 总下载量: 773
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固