PHPackages                             markrogoyski/numverify-api-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. markrogoyski/numverify-api-client-php

ActiveLibrary[API Development](/categories/api)

markrogoyski/numverify-api-client-php
=====================================

Numverify API Client for PHP

v3.0.0(2mo ago)1220.9k↓50%4MITPHPPHP &gt;=8.2.0CI passing

Since Dec 2Pushed 2mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (19)Versions (11)Used By (0)

Numverify API Client Library for PHP
====================================

[](#numverify-api-client-library-for-php)

Numverify phone number validation and country API client library for PHP.

[![Coverage Status](https://camo.githubusercontent.com/0997739dd7956e4b435656efd9a521fa33204420c38bbd4a31ea2a8daedd9dbe/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d61726b726f676f79736b692f6e756d7665726966792d6170692d636c69656e742d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/markrogoyski/numverify-api-client-php?branch=master)[![License](https://camo.githubusercontent.com/d9121debc9cb10849cfed87b11a9a8bda2942acfaeec490eb713e5be056dca70/68747470733a2f2f706f7365722e707567782e6f72672f6d61726b726f676f79736b692f6e756d7665726966792d6170692d636c69656e742d7068702f6c6963656e7365)](https://packagist.org/packages/markrogoyski/numverify-api-client-php)[![Latest Stable Version](https://camo.githubusercontent.com/58ed48d9d9142ca16f562ebeb95d0213a68bf881193382bffe59bc632f243c1d/68747470733a2f2f706f7365722e707567782e6f72672f6d61726b726f676f79736b692f6e756d7665726966792d6170692d636c69656e742d7068702f76)](https://packagist.org/packages/markrogoyski/numverify-api-client-php)[![Downloads](https://camo.githubusercontent.com/540ae3bb0cf5dc25487c7d80dd3d33f8dd00b2b0f531657a72ec05e75a26517a/68747470733a2f2f706f7365722e707567782e6f72672f6d61726b726f676f79736b692f6e756d7665726966792d6170692d636c69656e742d7068702f646f776e6c6f616473)](https://packagist.org/packages/markrogoyski/numverify-api-client-php)

Features
--------

[](#features)

- Phone number validation API
    - Validate phone numbers
    - Carrier information
    - Line type
    - Location info: country, local information
    - Phone number formats
- Countries API
    - List of countries
    - Country names, country codes, dialing codes

Numverify API documentation:

Setup
-----

[](#setup)

Add the library to your `composer.json` file in your project:

```
{
  "require": {
      "markrogoyski/numverify-api-client-php": "3.*"
  }
}
```

Use [composer](http://getcomposer.org) to install the library:

```
$ composer install
```

Composer will install Numverify API Client Library for PHP inside your vendor folder. Then you can add the following to your .php files to the use library with Autoloading.

```
require_once(__DIR__ . '/vendor/autoload.php');
```

Alternatively, use composer on the command line to require and install Numverify API Client Library:

```
$ composer require markrogoyski/numverify-api-client-php:3.*

```

### Minimum Requirements

[](#minimum-requirements)

- PHP 8.2
    - (For PHP 7.2–8.1, use [v2.0](https://github.com/markrogoyski/numverify-api-client-php/releases/tag/v2.2.0))
    - (For PHP 7.0–7.1, use [v1.0](https://github.com/markrogoyski/numverify-api-client-php/releases/tag/v1.0.0))

Usage
-----

[](#usage)

### Create New API

[](#create-new-api)

```
$accessKey = 'AccountAccessKeyGoesHere';
$api       = new \Numverify\Api($accessKey);
```

### Phone Number Validation API

[](#phone-number-validation-api)

```
$phoneNumber          = '14158586273';
$validatedPhoneNumber = $api->validatePhoneNumber($phoneNumber);

// Phone number information
if ($validatedPhoneNumber->isValid()) {
    $number              = $validatedPhoneNumber->getNumber();               // 14158586273
    $localFormat         = $validatedPhoneNumber->getLocalFormat();          // 4158586273
    $internationalPrefix = $validatedPhoneNumber->getInternationalFormat();  // +14158586273
    $countryPrefix       = $validatedPhoneNumber->getCountryPrefix();        // +1
    $countryCode         = $validatedPhoneNumber->getCountryCode();          // US
    $countryName         = $validatedPhoneNumber->getCountryName();          // United States of America
    $location            = $validatedPhoneNumber->getLocation();             // Novato
    $carrier             = $validatedPhoneNumber->getCarrier();              // AT&T Mobility LLC
    $lineType            = $validatedPhoneNumber->getLineType();             // mobile
}

// Use optional country code parameter for local (non-E.164) phone numbers
$phoneNumber = '4158586273';
$countryCode = 'US';
$validatedPhoneNumber = $api->validatePhoneNumber($phoneNumber, $countryCode);

// PHP Interfaces
$stringRepresentation = (string) $validatedPhoneNumber;
$jsonRepresentation   = json_encode($validatedPhoneNumber);
```

### Countries API

[](#countries-api)

```
$countries = $api->getCountries();

// Find countries (by country code or by name)
$unitedStates = $countries->findByCountryCode('US');
$japan        = $countries->findByCountryName('Japan');

// Country information
$usCountryCode = $unitedStates->getCountryCode();  // US
$usCountryName = $unitedStates->getCountryName();  // United States
$usDialingCode = $unitedStates->getDialingCode();  // +1

$japanCountryCode = $japan->getCountryCode();       // JP
$japanCountryName = $japan->getCountryName();       // Japan
$japanDialingCode = $japan->getDialingCode();       // +81

// Country collection is iterable
foreach ($countries as $country) {
    $countryCode = $country->getCountryCode();
    $countryName = $country->getCountryName();
    $dialingCode = $country->getDialingCode();
}

// Country collection PHP interfaces
$numberOfCountries  = count($countries);
$jsonRepresentation = json_encode($numberOfCountries);

// Country PHP interfaces
$stringRepresentation = (string) $unitedStates;      // US: United States (+1)
$jsonRepresentation   = json_encode($unitedStates);
```

### Options

[](#options)

```
// Construct API to use HTTPS for API calls
$useHttps = true;
$api      = new \Numverify\Api($accessKey, $useHttps);  // Optional second parameter
```

### Exceptions

[](#exceptions)

API failures throw a `NumverifyApiFailureException`

```
// Numverify API server error
try {
    $validatedPhoneNumber = $api->validatePhoneNumber($phoneNumber);
} catch (\Numverify\Exception\NumverifyApiFailureException $e) {
    $statusCode = $e->getStatusCode();  // 500
    $message    = $e->getMessage();     // Unknown error - 500 Internal Server Error
}

// Numverify API failure response
try {
    $validatedPhoneNumber = $api->validatePhoneNumber($phoneNumber);
} catch (\Numverify\Exception\NumverifyApiFailureException $e) {
    $statusCode = $e->getStatusCode();  // 200
    $message    = $e->getMessage();     // Type:invalid_access_key Code:101 Info:You have not supplied a valid API Access Key.
}
```

Unit Tests
----------

[](#unit-tests)

```
$ cd tests
$ phpunit
```

[![Coverage Status](https://camo.githubusercontent.com/0997739dd7956e4b435656efd9a521fa33204420c38bbd4a31ea2a8daedd9dbe/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d61726b726f676f79736b692f6e756d7665726966792d6170692d636c69656e742d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/markrogoyski/numverify-api-client-php?branch=master)

Standards
---------

[](#standards)

Numverify API Client Library for PHP conforms to the following standards:

- PSR-1 - Basic coding standard ()
- PSR-4 - Autoloader ()
- PSR-12 - Extended coding style guide ()

License
-------

[](#license)

Numverify API Client Library for PHP is licensed under the MIT License.

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance86

Actively maintained with recent releases

Popularity34

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 95.7% 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 ~379 days

Recently: every ~495 days

Total

8

Last Release

71d ago

Major Versions

v0.1.0 → v1.0.02020-06-25

v1.0.x-dev → v2.0.02020-10-06

v2.2.0 → v3.0.02026-03-08

PHP version history (3 changes)v0.1.0PHP &gt;=7.0.0

v2.0.0PHP &gt;=7.2.0

v3.0.0PHP &gt;=8.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10004372?v=4)[Mark Rogoyski](/maintainers/markrogoyski)[@markrogoyski](https://github.com/markrogoyski)

---

Top Contributors

[![markrogoyski](https://avatars.githubusercontent.com/u/10004372?v=4)](https://github.com/markrogoyski "markrogoyski (45 commits)")[![editionslva](https://avatars.githubusercontent.com/u/26386519?v=4)](https://github.com/editionslva "editionslva (1 commits)")[![tenshiAMD](https://avatars.githubusercontent.com/u/13580338?v=4)](https://github.com/tenshiAMD "tenshiAMD (1 commits)")

---

Tags

apiclientphone-numbercountry codesnumverifycarrier lookupvalidate phone numberdialing codes

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/markrogoyski-numverify-api-client-php/health.svg)

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

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69433.0M114](/packages/algolia-algoliasearch-client-php)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[resend/resend-php

Resend PHP library.

574.7M21](/packages/resend-resend-php)[crowdin/crowdin-api-client

PHP client library for Crowdin API v2

611.5M5](/packages/crowdin-crowdin-api-client)

PHPackages © 2026

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