Skip to content

bencarter78/HumanNameParser

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Human Name Parser

Forked from [https://github.com/jasonpriem/HumanNameParser.php]

Description

Takes human names of arbitrary complexity and various wacky formats like:

  • J. Walter Weatherman
  • de la Cruz, Ana M.
  • James C. ('Jimmy') O'Dell, Jr.

and parses out the:

  • leading initial (Like "J." in "J. Walter Weatherman")
  • first name (or first initial in a name like 'R. Crumb')
  • nicknames (like "Jimmy" in "James C. ('Jimmy') O'Dell, Jr.")
  • middle names
  • surname (including compound ones like "van der Sar' and "Ortega y Gasset"), and
  • suffix (like 'Jr.', 'III')

Example Usage

$parser = new Tck\HumanNameParser\Parser("John Q. Smith");
echo  $parser->surname() . ", " . $parser->firstName();
// returns "Smith, John"

About

Returns the parts (leading initial, first, middle, last, suffix) of a name from a string.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 100.0%