PHPackages                             enzyme/name - 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. enzyme/name

ActiveLibrary

enzyme/name
===========

Name manipulation library for PHP.

v1.0.3(9y ago)318MITPHPPHP &gt;=5.5.0

Since Dec 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/enzyme/name)[ Packagist](https://packagist.org/packages/enzyme/name)[ Docs](https://github.com/enzyme/name)[ RSS](/packages/enzyme-name/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (4)Versions (10)Used By (0)

[![](https://cloud.githubusercontent.com/assets/2805249/11685005/7af1aa74-9ec1-11e5-924c-711068f7adde.png)](https://cloud.githubusercontent.com/assets/2805249/11685005/7af1aa74-9ec1-11e5-924c-711068f7adde.png)

[![Build Status](https://camo.githubusercontent.com/aff862638f98ad7a0cdc1886faf3565bfa1deb1e97f12e4e60a5f394e1a1d39a/68747470733a2f2f7472617669732d63692e6f72672f656e7a796d652f6e616d652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/enzyme/name)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/17fc461b6854616fec529848ba608f8daaf1d9e609ac29e4da3ce63249ba7ef5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656e7a796d652f6e616d652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/enzyme/name/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/c091de3b62937135a3df8f8886069a2d444caad11d136acde0193c75f3d2be75/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f656e7a796d652f6e616d652f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/enzyme/name?branch=master)

Name manipulation library for PHP.

What is it?
===========

[](#what-is-it)

If your website accepts user data in the form of *First Name*, *Last Name* and optionally *Middle* and/or *Prefix (Dr., Mrs.)* and then you would like to format the data - this package is for you.

Installation
============

[](#installation)

```
composer require enzyme/name
```

Usage
=====

[](#usage)

#### Standard first and last names.

[](#standard-first-and-last-names)

```
use Enzyme\Name\Simple;

$name = Simple::fromString('Hubert Cumberdale');
echo $name->getFirst(); // Hubert
echo $name->getLast(); // Cumberdale
```

#### Formatted first and last names.

[](#formatted-first-and-last-names)

```
use Enzyme\Name\Simple;
use Enzyme\Name\Format;

$name = Simple::fromString('Hubert Cumberdale');
$fmt = Format($name);

echo $fmt->like('First'); // Hubert
echo $fmt->like('First L.'); // Hubert C.
echo $fmt->like('Last, F.'); // Cumberdale, H.

// Quickfire option.
echo Format::nameLike($name, 'First L.'); // Hubert C.
```

#### Formatted full names (with middle/prefix).

[](#formatted-full-names-with-middleprefix)

```
use Enzyme\Name\Simple;
use Enzyme\Name\Format;

$name = Simple::fromString('Dr. Hubert Alberto Cumberdale');

echo Format::nameLike($name, 'First M. Last'); // Hubert A. Cumberdale
echo Format::nameLike($name, 'P. First M. Last'); // Dr. Hubert A. Cumberdale
echo Format::nameLike($name, 'P. Last, F. M.'); // Dr. Cumberdale, H. A.
```

Name options
============

[](#name-options)

`Simple` exposes the follow accessors which return `Part` instances.

`$name->getPrefix();``$name->getFirst();``$name->getMiddle();``$name->getLast();`

Each `Part` has two options:

`$part->long()` Returns the long version of the name, eg: Hubert `$part->short()` Returns the short version of the name, eg: H.

You can build a new name in 3 ways:

`Simple::fromString(...)` Simply pass in a string and it will 'intelligently' try and parse the name out from it.

`Simple::fromArgs(...)` Simply pass in arguments and it will try and build the full name from them. The name is build based on the number of arguments passed in, so 1 argument equals to the `first` name, 2 -&gt; `first last`, 3 -&gt; `first middle last` and 4 -&gt; `prefix first middle last`.

So to create the name `Hubert Cumberdale` using the `fromArgs` constructor, it would look like `Simple::fromArgs('Hubert', 'Cumberdale');`.

The last option give you the most control, `Simple::strict()`. It simply returns a new `Simple` object which you then explicitly build up using the setters: `$simple->prefix(...);`, `$simple->first(...);`, `$simple->middle(...);` and `$simple->last(...);`. Each setter can be optionally called to build names of different configurations.

Formatter Options
=================

[](#formatter-options)

The following examples use the name `Mr. Hubert Alfred Smith Cumberdale`

MarkerReturned NamePrefixMr.P.Mr.FirstHubertF.H.LastCumberdaleL.C.MiddleAlfred SmithM.A. S.Any other character will be left untouched. So for example you can create the name `Cumberdale, H. A. S.` from the following format string `Last, F. M.`

###  Health Score

28

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~17 days

Recently: every ~29 days

Total

8

Last Release

3640d ago

Major Versions

v0.0.4 → v1.0.02015-12-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/148afe40f056b8f57e43ed0505c6040f762e26805b1d1bebed87484d529bae07?d=identicon)[r3oath](/maintainers/r3oath)

---

Top Contributors

[![r3oath](https://avatars.githubusercontent.com/u/2805249?v=4)](https://github.com/r3oath "r3oath (45 commits)")

---

Tags

phpmanipulationnameenzyme

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/enzyme-name/health.svg)

```
[![Health](https://phpackages.com/badges/enzyme-name/health.svg)](https://phpackages.com/packages/enzyme-name)
```

###  Alternatives

[doctrine/inflector

PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.

11.4k842.2M637](/packages/doctrine-inflector)[imal-h/pdf-box

The most advanced, driver-based PDF manipulation library for PHP v3.0. Supports Ghostscript, Chrome Headless (HTML to PDF), OpenSSL/FPDI (Signing), and PDFtk (Forms).

59400.0k](/packages/imal-h-pdf-box)[adci/full-name-parser

Parses a human name

29698.9k5](/packages/adci-full-name-parser)[phery/phery

XAJAX alternative, phery.js is a library in PHP that maps to all jQuery functions, DOM manipulation, meta arguments and serialization, seamless ajax integration, RESTful emulation, form submission and partial rendering views, plus its PSR-0 compatible

13413.0k2](/packages/phery-phery)[jasonlam604/stringizer

Stringizer is a PHP string manipulation library with support for method chaining and multibyte handling

35110.5k](/packages/jasonlam604-stringizer)[ondrs/hi

Czech names and surnames greeting generator API PHP wrapper

4064.5k](/packages/ondrs-hi)

PHPackages © 2026

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