jabarihunt / format
Class to hold static formatting helper methods.
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/jabarihunt/format
Requires
- php: >=7.1.0
 
This package is auto-updated.
Last update: 2025-10-18 06:51:05 UTC
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.