PHPackages                             naviocean/laravel-nameparser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. naviocean/laravel-nameparser

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

naviocean/laravel-nameparser
============================

PHP library to split names into their respective components. Besides detecting first and last names, this library attempts to handle prefixes, suffixes, initials and compound last names like 'Von Fange'. It also normalizes prefixes (Mister -&gt; Mr.) and fixes capitalization (JOHN SMITH -&gt; John Smith).

15.5k1PHP

Since Dec 7Pushed 10y ago1 watchersCompare

[ Source](https://github.com/naviocean/laravel-nameparser)[ Packagist](https://packagist.org/packages/naviocean/laravel-nameparser)[ RSS](/packages/naviocean-laravel-nameparser/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP-Name-Parser For Laravel 5
=============================

[](#php-name-parser-for-laravel-5)

PHP library to split names into their respective components. Besides detecting first and last names, this library attempts to handle prefixes, suffixes, initials and compound last names like "Von Fange". It also normalizes prefixes (Mister -&gt; Mr.) and fixes capitalization (JOHN SMITH -&gt; John Smith).

**Usage:**Enter command

```
"composer require naviocean/laravel-nameparser:dev-master"
```

**Results:**

```
Array (
	[nickname] =>
    [salutation] => Mr.
    [fname] => Anthony
    [initials] => R
    [lname] => Von Fange
    [suffix] => III
)

```

**The algorithm:**

We start by splitting the full name into separate words. We then do a dictionary lookup on the first and last words to see if they are a common prefix or suffix. Next, we take the middle portion of the string (everything minus the prefix &amp; suffix) and look at everything except the last word of that string. We then loop through each of those words concatenating them together to make up the first name. While we’re doing that, we watch for any indication of a compound last name. It turns out that almost every compound last name starts with 1 of 16 prefixes (Von, Van, Vere, etc). If we see one of those prefixes, we break out of the first name loop and move on to concatenating the last name. We handle the capitalization issue by checking for camel-case before uppercasing the first letter of each word and lowercasing everything else. I wrote special cases for periods and dashes. We also have a couple other special cases, like ignoring words in parentheses all-together.

Check examples.php for the test suite and examples of how various name formats are parsed.

**To-do**

- Handle the "Lname, Fname" format
- Support non-English names (handle unicode characters &amp; better understand global naming rules)
- Separate the parsing of the name from the normalization &amp; capitalization &amp; make those optional.
- Add common name libraries to allow for things like gender detection

**Credits &amp; license:**

- Read more about the inspiration for this [PHP Name Parser](http://www.onlineaspect.com/2009/08/17/splitting-names/) library
- Special thanks to [Josh Fraser](http://joshfraser.com), [Josh Jones](https://github.com/UberNerdBoy), [Timothy Wood](https://github.com/codearachnid), [Michael Waskosky](https://github.com/waskosky), [Eric Celeste](https://github.com/efc) and [Josh Houghtelin](https://github.com/jhoughtelin) for their contributions. Pull requests are always welcome as long as you don't break the test suite.
- Released under Apache 2.0 license

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9401973?v=4)[Duong Le](/maintainers/naviocean)[@naviocean](https://github.com/naviocean)

### Embed Badge

![Health badge](/badges/naviocean-laravel-nameparser/health.svg)

```
[![Health](https://phpackages.com/badges/naviocean-laravel-nameparser/health.svg)](https://phpackages.com/packages/naviocean-laravel-nameparser)
```

###  Alternatives

[garethellis/crontab-schedule-generator

A PHP library for generating crontab schedule strings using expressive code

107.8k](/packages/garethellis-crontab-schedule-generator)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
