定制 humans/name-of-person 二次开发

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

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

humans/name-of-person

最新稳定版本:4.0.0

Composer 安装命令:

composer require humans/name-of-person

包简介

A wrappr for parsing people's names.

README 文档

README

A port of Basecamp's name of person library.

A library to make an much more expressive breakdown of a user's name.

This is a pretty simplified library without accounting for any of the edge cases of how names are handled, just something usable where everything after the first name is treated as the last name.

Installation

composer require humans/name-of-person

Upgrade Notes

The API now returns an instance of the PersonName class instead of the string to allow for method chaining. This should not affect most of the use cases.

Usage

use Humans\NameOfPerson\PersonName; $name = new PersonName('Terry Crews'); $name->full; // => "Terry Crews" $name->first; // => "Terry" $name->last; // => "Crews" $name->initials; // => "TC" $name->familiar; // => "Terry C." $name->abbreviated; // => "T. Crews" $name->sorted; // => "Crews, Terry" $name->mentionable; // => "terryc" $name->possessive; // => "Terry Crews'" $name->first->possessive // => Terry's $name->last->possessive // => Crews'

The Laravel Trait has been removed!

I ended up not using the trait since there are projects that I wanted to use a different key for the name. Instead, if you want to use the library, I highly suggest using a different attribute to avoid conflicts when building JSON APIs.

use Humans\NameOfPerson\PersonName; class User { public function getNameAttribute() { return new PersonName($this->attributes['full_name']); } }

统计信息

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

GitHub 信息

  • Stars: 9
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固