PHPackages                             tacman/nameapi-client-php - 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. [API Development](/categories/api)
4. /
5. tacman/nameapi-client-php

ActiveLibrary[API Development](/categories/api)

tacman/nameapi-client-php
=========================

PHP Client for the NameAPI Web Service

6.0(1y ago)0329LGPL-3.0PHPPHP &gt;=8.1

Since May 3Pushed 1y agoCompare

[ Source](https://github.com/tacman/nameapi-client-php)[ Packagist](https://packagist.org/packages/tacman/nameapi-client-php)[ Docs](https://github.com/optimaize/nameapi-client-php)[ RSS](/packages/tacman-nameapi-client-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (9)Used By (0)

nameapi-client-php
==================

[](#nameapi-client-php)

PHP Client for the NameAPI Web Service at

All you need to send requests is your own api key, get it from nameapi.org.

This library is simply a fork of , which is a fork of the original library, but the original library does not support PSR-4 namespaced, which composer 2 requires.

Library setup
-------------

[](#library-setup)

```
composer require tacman/nameapi-client-php
```

Functional tests
----------------

[](#functional-tests)

Functional tests that demonstrate how the services work, and that they work, are in  you can look at the code, and you can even run those tests using your api key and PHPUnit.

Setup code
----------

[](#setup-code)

At first you need one single include, the one to the nameapi service factory:

```
require_once('your/path/to/Org/NameApi/Client/Services/ServiceFactory.php');
```

Then you need a Context that explains a bit your working environment, something like:

```
use Org\NameApi\Ontology\input\Context\Context;
use Org\NameApi\Ontology\input\Context\Priority;
$context = Context::builder()
    ->place('US')
    ->priority(Priority::REALTIME)
    ->build();
```

Then you can already create the service factory which gives you access to all nameapi services:

```
$serviceFactory = new ServiceFactory('your-api-key', $context);
```

Send a ping
-----------

[](#send-a-ping)

This code sends a simple ping to nameapi to test the connection:

```
$ping = $serviceFactory->systemServices()->ping();
$pong = $ping->ping();
```

If the response is 'pong' then all is fine and you can move on to the real goodies.

Input / Output
--------------

[](#input--output)

All input objects come with builders or nicely documented setters. The result objects returned by the services all have fully documented getters. Many input arguments are optional - that means you can start simple, and add more as you need.

Behind the scenes this service api uses REST. But luckily you don't need to worry about any of the interface detail, you can just use the provided classes.

#### Person input object

[](#person-input-object)

Most services accept a 'Person' as input. This person contains a name, and optionally more data such as gender, birth date etc. The name can be just a single "full name" string, or it can be composed of multiple fields like given name, middle name, surname. This standardized api makes it simple to use different services in a consistent way, and is very convenient in accepting the data however you have it at hands.

Creating a simple person looks something like this:

```
use Org\NameApi\Ontology\input\Entities\Person\NaturalInputPerson;
use Org\NameApi\Ontology\input\Entities\Person\Name\InputPersonName;
$inputPerson = NaturalInputPerson::builder()
    ->name(InputPersonName::westernBuilder()
        ->fullname( "John F. Kennedy" )
        ->build())
    ->build();
```

Name Parser
-----------

[](#name-parser)

Name parsing is the process of splitting a full name into its components.

Using the $inputPerson created earlier:

```
$personNameParser = $this->makeServiceFactory()->parserServices()->personNameParser();
$parseResult = $personNameParser->parse($inputPerson);
var_dump($parseResult);
```

Name Genderizer
---------------

[](#name-genderizer)

Name genderizing is the process of identifying the gender based on a person's name.

Using the $inputPerson created earlier:

```
$personGenderizer = $serviceFactory->genderizerServices()->personGenderizer();
$personGenderResult = $personGenderizer->assess($inputPerson);
echo $personGenderResult->getGender()->toString(); //will print 'MALE'
```

Name Matcher
------------

[](#name-matcher)

The Name Matcher compares names and name pairs to discover whether the people could possibly be one and the same person.

This service takes 2 people as input:

```
$personMatcher = $serviceFactory->matcherServices()->personMatcher();
$inputPerson1 = NaturalInputPerson::builder()
    ->name(InputPersonName::westernBuilder()
        ->fullname( "John F. Kennedy" )
        ->build())
    ->build();
$inputPerson2 = NaturalInputPerson::builder()
    ->name(InputPersonName::westernBuilder()
        ->fullname( "Jack Kennedy" )
        ->build())
    ->build();
$personMatcherResult = $personMatcher->match($inputPerson1, $inputPerson2);
echo $personMatcherResult->getPersonMatchType()->toString(); //will print 'MATCHING'
```

Name Formatter
--------------

[](#name-formatter)

The Name Formatter displays personal names in the desired form. This includes the order as well as upper and lower case writing.

```
$personNameFormatter = $serviceFactory->formatterServices()->personNameFormatter();
$inputPerson = NaturalInputPerson::builder()
    ->name(InputPersonName::westernBuilder()
        ->fullname( "john kennedy" )
        ->build())
    ->build();
$formatterResult = $personNameFormatter->format($inputPerson, new FormatterProperties());
echo $formatterResult->getFormatted(); //will print 'John Kennedy'
```

Email Name Parser
-----------------

[](#email-name-parser)

The Email Name Parser extracts names out of email addresses.

```
$emailNameParser = $serviceFactory->emailServices()->emailNameParser();
$result = $emailNameParser->parse("john.doe@example.com");
echo $result;
```

Disposable Email Address Detector
---------------------------------

[](#disposable-email-address-detector)

The DEA-Detector checks email addresses against a list of known "trash domains" such as mailinator.com.

```
$deaDetector = $serviceFactory->emailServices()->disposableEmailAddressDetector();
$result = $deaDetector->isDisposable("abcdefgh@10minutemail.com");
echo $result->getDisposable()->toString()); //will print 'YES'
```

Risk Detector
-------------

[](#risk-detector)

The Risk-Detector checks all data in the person input, including the name, address, birthdate, email address and phone number for fake and suspicious data.

```
$riskDetector = $serviceFactory->riskServices()->personRiskDetector();
$riskResult = $riskDetector->detect($inputPerson);
var_dump($riskResult);
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~428 days

Recently: every ~629 days

Total

8

Last Release

669d ago

Major Versions

5.3.0-rc4 → 6.02024-07-18

PHP version history (2 changes)5.0.0-rc2PHP &gt;=5.3.0

6.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/21b39551f92ed4143772c622f9e571589c5a72c96ab3c53fe67489ce0d83e806?d=identicon)[tacman1123](/maintainers/tacman1123)

---

Top Contributors

[![fabiankessler](https://avatars.githubusercontent.com/u/2506130?v=4)](https://github.com/fabiankessler "fabiankessler (91 commits)")[![mstralka](https://avatars.githubusercontent.com/u/439680?v=4)](https://github.com/mstralka "mstralka (9 commits)")[![stefancretu](https://avatars.githubusercontent.com/u/2303103?v=4)](https://github.com/stefancretu "stefancretu (3 commits)")[![tacman](https://avatars.githubusercontent.com/u/619585?v=4)](https://github.com/tacman "tacman (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tacman-nameapi-client-php/health.svg)

```
[![Health](https://phpackages.com/badges/tacman-nameapi-client-php/health.svg)](https://phpackages.com/packages/tacman-nameapi-client-php)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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