Skip to content

A universal, language-independent name parser PHP library

License

Notifications You must be signed in to change notification settings

JeroenVanLeusden/name-parser

 
 

Repository files navigation

THE ICONIC Name Parser

Build Status Coverage Status Scrutinizer Code Quality Latest Stable Version Total Downloads License Dependency Status

Purpose

This is a universal, language-independent name parser.

Its purpose is to split a single string containing a full name, possibly including salutation, initials, suffixes etc., into meaningful parts like firstname, lastname, initials, and so on.

It is mostly tailored towards english names but works pretty well with non-english names as long as they use latin spelling.

E.g. Mr Anthony R Von Fange III is parsed to

  • salutation: Mr.
  • firstname: Anthony
  • initials: R
  • lastname: von Fange
  • suffix: III

Setup

composer require theiconic/name-parser

Usage

<?php

$parser = new TheIconic\NameParser\Parser();

$name = $parser->parse($input);

echo $name->getSalutation();
echo $name->getFirstname();
echo $name->getLastname();
echo $name->getMiddlename();
echo $name->getNickname();
echo $name->getInitials();
echo $name->getSuffix();

An empty string is returned for missing parts.

Examples

An wide array of successfully parsed names can be found in the parser unit test.

License

THE ICONIC Name Parser library for PHP is released under the MIT License.

About

A universal, language-independent name parser PHP library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%