jabarihunt/format
Composer 安装命令:
composer require jabarihunt/format
包简介
Class to hold static formatting helper methods.
README 文档
README
This class was developed to hold static formatting helper methods as outlined below...
Getting Started
Prerequisites
- PHP 7.1 or greater (due to type hinting)
INSTALLING
Via Composer
Run the following command in the same directory as your composer.json file:
php composer.phar require jabarihunt/format
Via Github
- Clone this repository into a working directory:
git clone git@github.com:jabarihunt/format - Include the Format class in your project...
require('/path/to/Format.php')
...or if using an auto-loader...
use jabarihunt/Format
USAGE
name(string $name):
Credit for the original method goes to Armand Niculescu.
This method correctly capitalizes names when there are prefixes & suffixes, apostrophes, name parts that shouldn't be capitalized, and in other scenarios where using something like ucwords(strtolower($str)) doesn't work.
Examples:
$name |
ucwords(strtolower($name)) |
Format::name($name) |
|---|---|---|
| michael o’carrol | Michael O’carrol | Michael O’Carrol |
| lucas l’amour | Lucas L’amour | Lucas l’Amour |
| george d’onofrio | George D’onofrio | George d’Onofrio |
| william stanley iii | William Stanley Iii | William Stanley III |
| UNITED STATES OF AMERICA | United States Of America | United States of America |
| t. von lieres und wilkau | T. Von Lieres Und Wilkau | T. von Lieres und Wilkau |
| paul van der knaap | Paul Van Der Knaap | Paul van der Knaap |
| jean-luc picard | Jean-luc Picard | Jean-Luc Picard |
| JOHN MCLAREN | John Mclaren | John McLaren |
| hENRIC vIII | Henric Viii | Henric VIII |
| VAsco da GAma | Vasco Da Gama | Vasco da Gama |
CONTRIBUTING
- Fork Repository
- Create a descriptive branch name
- Make edits to your branch
- Squash (rebase) your commits
- Create a pull request
LICENSE
This project is licensed under the MIT License - see the LICENSE.md file for details.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-17