定制 vorgas/proper-naming 二次开发

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

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

vorgas/proper-naming

Composer 安装命令:

composer require vorgas/proper-naming

包简介

Tools for correcting capitalization on various proper names

README 文档

README

An advanced and extensible proper name casing strategy

Turns MIKE HILL into Mike Hill, and ANGUS MACGUYVER into Angus MacGuyver. And if somebody types in John MacDonald and Ian Macloud, it figures they know what they are doing, and leaves the capitalization the way it was submitted.

With proper usage, it will not only turn angel d'arcy into Angel D'Arcy but knows to leave well enough alone and make HELL'S BELLS into Hell's Bells.

Features At A Glance

  • Different strategies for people and places
  • Adjustable in real time through public properties
  • Force words to all upper or all lower case
  • Detect properly formatted overrides on edge cases
  • Callable objects for cleaner code

Installation

From within your project...

# composer require vorgas/proper-naming:dev-main

Basic Usage

Just call the appropriate class with the string to case.

use ProperNaming\PeopleCasing;
$ProperName = new PeopleCasing();
$ProperName('MIKE HILL'); # Mike Hill
$ProperName('rip van winkle'); # Rip van Winkle
$ProperName('van trapp'); # Van Trapp <-- A person's actual name
$ProperName('van trapp', false); # van Trapp <-- The family name
$ProperName('john smith iii'); # John Smith III

Casing Strategies

Other Topics

Acknowledgement

The logic behind the delimiter array was freaking genius. I also kept his original case force exceptions, but added some extras.

License

Licensed under the MIT License - see the License for details

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-12