vorgas/proper-naming

Tools for correcting capitalization on various proper names

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 1

pkg:composer/vorgas/proper-naming

dev-main 2023-08-13 14:30 UTC

This package is auto-updated.

Last update: 2025-12-13 19:43:23 UTC


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