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
- Proper Name - Basic Proper Name capitalization
- People Casing - Some enhanced family name distinctions
- Business Casing - Business name overrides and oddities
- City Casing - Handles various city naming conventions
- US State Casing - Caps the 2-letter codes for states & territories
- Custom Casing - Roll your own custom rules and overrides
Other Topics
Acknowledgement
- Derived from the script at
- https://www.media-division.com/correct-name-capitalization-in-php/
- Armand Niculescu - https://www.media-division.com/author/armand/
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
vorgas/proper-naming 适用场景与选型建议
vorgas/proper-naming 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 08 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vorgas/proper-naming 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vorgas/proper-naming 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-12