PHPackages                             e164-com/e164-php-sdk - 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. e164-com/e164-php-sdk

ActiveLibrary[API Development](/categories/api)

e164-com/e164-php-sdk
=====================

A PHP SDK for interacting with the e164.com API.

2.1(1mo ago)118MITPHPPHP ^8.1CI passing

Since Apr 17Pushed 1mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (5)Versions (4)Used By (0)

E164 PHP SDK
============

[](#e164-php-sdk)

[![Tests](https://github.com/e164-com/e164-php-sdk/actions/workflows/ci.yml/badge.svg)](https://github.com/e164-com/e164-php-sdk/actions/workflows/ci.yml)[![Latest Version](https://camo.githubusercontent.com/9c08e975f6542935488c9b2f54b2cbea8272bfac6b7f4968e026d337c740726a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f653136342d636f6d2f653136342d7068702d73646b2e737667)](https://packagist.org/packages/e164-com/e164-php-sdk)[![PHPStan](https://camo.githubusercontent.com/d117944b58da8146f96b4ef7403807610a20eeb3fbcaaaf95157bbcdad1686eb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e737667)](https://phpstan.org/)[![PHP](https://camo.githubusercontent.com/7535257ca228724c93658bd52583d4e47a9bab02c356abf6e54c1d575f2151e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c75652e737667)](https://www.php.net/)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

The official PHP SDK for the [E164 API](https://e164.com) — phone number validation and network lookup.

Requirements
------------

[](#requirements)

- PHP 8.1+
- ext-json

Installation
------------

[](#installation)

```
composer require e164-com/e164-php-sdk
```

Quick Start
-----------

[](#quick-start)

```
use Vendor\E164\E164;

$e164 = new E164();
$result = $e164->lookup('441133910781');

echo $result->getType();            // "GEOGRAPHIC"
echo $result->getCallingCode();     // "44"
echo $result->getIso3();            // "GBR"
echo $result->getOperatorBrand();   // "BT"
```

Authentication (Optional)
-------------------------

[](#authentication-optional)

The E164 API works without authentication, but if you have an API key you can pass it as the second parameter:

```
$e164 = new E164(null, 'your-api-key');
$result = $e164->lookup('441133910781');
```

This sends the key as an `X-API-Key` header with every request.

Working with Results
--------------------

[](#working-with-results)

```
$result = $e164->lookup('441133910781');

// Number identification
$result->getPrefix();          // "44113391"
$result->getCallingCode();     // "44"
$result->getIso3();            // "GBR"
$result->getType();            // "GEOGRAPHIC"
$result->getLocation();        // Location if available

// Network details
$result->getTadig();           // TADIG code
$result->getMccmnc();          // "234"
$result->getOperatorBrand();   // "BT"
$result->getOperatorCompany(); // "BT"

// Number length constraints
$result->getTotalLengthMin();  // "12"
$result->getTotalLengthMax();  // "12"

// Metadata
$result->getWeight();          // "11"
$result->getSource();          // "e164.com"
```

Input Format
------------

[](#input-format)

The SDK accepts phone numbers in various formats. Non-numeric characters (except `+`) are stripped automatically:

```
$e164->lookup('441133910781');      // digits only
$e164->lookup('+441133910781');     // with + prefix
$e164->lookup('+44-113-391-0781'); // formatted
```

Custom HTTP Client
------------------

[](#custom-http-client)

You can inject your own Guzzle client for custom configuration (proxies, timeouts, etc.):

```
use GuzzleHttp\Client;
use Vendor\E164\E164;

$client = new Client([
    'timeout' => 10,
    'headers' => [
        'User-Agent' => 'MyApp/1.0',
    ],
]);

$e164 = new E164($client);
```

Error Handling
--------------

[](#error-handling)

```
use Vendor\E164\E164;
use Vendor\E164\Exception\InvalidPhoneNumberException;
use Vendor\E164\Exception\ApiException;

try {
    $result = $e164->lookup('441133910781');
} catch (InvalidPhoneNumberException $e) {
    // Phone number is empty, non-numeric, or not found
} catch (ApiException $e) {
    // HTTP request failed (network error, timeout, server error)
}
```

Both exceptions extend `RuntimeException`, so you can catch them individually or together.

Running Tests
-------------

[](#running-tests)

```
# Install dependencies
composer install

# Run tests
vendor/bin/phpunit

# Run static analysis
vendor/bin/phpstan analyse
```

Contributing
------------

[](#contributing)

Fork the repository and submit a pull request. Please include tests for any new features or bug fixes.

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance89

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity48

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.

###  Release Activity

Cadence

Every ~170 days

Total

3

Last Release

56d ago

Major Versions

1.0 → 2.02026-03-20

PHP version history (2 changes)1.0PHP ^7.4 || ^8.0

2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d805b7ed843e1f94763d7f2e352d3bb39a51b4a580b95cb1024268afe7279dd3?d=identicon)[cata](/maintainers/cata)

---

Tags

Api WrapperE164phone number validatione164 SDKphone number validation SDK

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/e164-com-e164-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/e164-com-e164-php-sdk/health.svg)](https://phpackages.com/packages/e164-com-e164-php-sdk)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[fiveam-code/laravel-notion-api

Laravel Wrapper for the Notion API

435224.4k1](/packages/fiveam-code-laravel-notion-api)[marcreichel/igdb-laravel

A Laravel wrapper for version 4 of the IGDB API (Apicalypse) including webhook handling

115146.6k1](/packages/marcreichel-igdb-laravel)[otherguy/php-currency-api

A PHP API Wrapper to offer a unified programming interface for popular Currency Rate APIs.

2526.2k](/packages/otherguy-php-currency-api)[grok-php/client

Grok PHP Client is a robust and community-driven PHP client library for seamless integration with Grok AI API, offering efficient access to advanced AI and data processing capabilities.

325.9k4](/packages/grok-php-client)

PHPackages © 2026

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