jaxwilko/human-name-processor

Simple name processing in php

v0.1.3 2020-05-19 15:05 UTC

This package is auto-updated.

Last update: 2024-12-20 01:07:06 UTC


README

This package aims to provide quick and easy name processing to produce a standardised format for name handling.

Installation

composer require jaxwilko/human-name-processor

Usage

<?php

require __DIR__ . '/vendor/autoload.php';

$processor = new JaxName\HumanNameProcessor();
$name = $processor->make('Mr. John Smith');

The processor make method returns an instance of JaxName\HumanName which provides methods for getting elements of the name. For instance:

$name->getTitle(); // Mr.
$name->getFirstName(); // John
$name->getLastName(); // Smith

// the class also provides a __toString method

echo $name; // Mr. John Smith

Testing

./vendor/bin/phpunit tests --testdox --color