PHPackages                             dammynex/ngr-phone-validator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. dammynex/ngr-phone-validator

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

dammynex/ngr-phone-validator
============================

A PHP Libary to validate a nigerian phone number based on availabe public data

0.1.16(1y ago)6127[1 PRs](https://github.com/dammynex/ngr-phone-validator/pulls)Apache-2.0PHPCI passing

Since Jun 23Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/dammynex/ngr-phone-validator)[ Packagist](https://packagist.org/packages/dammynex/ngr-phone-validator)[ RSS](/packages/dammynex-ngr-phone-validator/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (15)Used By (0)

\#ngr-phone-validator

A PHP Libary to validate a nigerian phone number based on availabe public data.

It utilizes some very common data to check if a Nigerian phone number is valid.

It's very easy to setup and use.

**Using composer**

```
composer require dammynex/ngr-phone-validator

```

**Manually**Download the zip package and require it

```
require_once 'path/to/dir/vendor/autoload.php';
```

**Validating a phone number without exceptions**

```
use Brainex\Tools\PhoneValidator;

$phone = (new PhoneValidator())
                //Phone number to validate
                ->setPhoneNumber('+2349061668519')
                //We do not want exceptions
                ->setThrowExceptions(false)
                //Do validation
                ->validate();

if($phone->isValid()) {
    echo 'The phone number is valid';
}
```

**Validating a phone number using exceptions**

```
use Brainex\Tools\PhoneValidator;
use Brainex\Exceptions\InvalidPhoneException;

try {
    $phone = (new PhoneValidator())
                ->setPhoneNumber('+2349061668519')
                ->validate();
} catch(InvalidPhoneException $e) {
    echo 'Invalid phone: ' . $e->getMessage();
}
```

When `PhoneValidator::isValid()` returns true, Other methods can be utilized.

MethodDescription\_\_toString()Returns the phone numbergetInternationalFormat()Returns the international format of the specified phone number (eg. +2349061668519)getInternationalFormatWithoutPlusPrefix()Returns the international format with the plus sign (eg. 2349061668519)getLength()Returns the length of the phone numbergetLocalFormat()Returns the local format of specified phone number (eg. 09061668519)getNetwork()Returns the phone number's networkgetPhoneNumber()Returns the raw (unedited) specified phone numbergetThrowExceptions()Returns whether validator is assigned to throw exceptionsisOfLength(int $length)Returns whether length of phone number matches a valid phone number length from the `Brainex\Tools\PhoneLengthParser` classisNetwork(string $network)Returns whether the phone number's network matches the specified `$network`. `$network` should be one from `Brainex\Tools\PhoneNetworkParser`isValid()Returns whether phone number is validisValidLength()Return whether phone's length is parsed and validsetPhoneNumber(string $phone)Assign phone number to validatorsetThrowExceptions()Assign whether exceptions should be throwntoJson()Return phone number's data in json stringvalidate()Initialize validation for the phone number- Supports Major Networks

Todo: Support other networks

- Smile
- Ntel
- Spectranet

Feel free to contribute!!!

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance63

Regular maintenance activity

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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 ~212 days

Recently: every ~178 days

Total

12

Last Release

591d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8891ae9aef685d0c7713adf9b15ccc6aecfcda776f6aaee3823ad7a137612550?d=identicon)[dammynex](/maintainers/dammynex)

---

Top Contributors

[![dammynex](https://avatars.githubusercontent.com/u/30000286?v=4)](https://github.com/dammynex "dammynex (30 commits)")

---

Tags

Nigeriaphone-numberphone-validationnigeria phonenigeria validate phone

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dammynex-ngr-phone-validator/health.svg)

```
[![Health](https://phpackages.com/badges/dammynex-ngr-phone-validator/health.svg)](https://phpackages.com/packages/dammynex-ngr-phone-validator)
```

###  Alternatives

[ronanguilloux/isocodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers &amp; Zipcodes for many countries

8123.5M27](/packages/ronanguilloux-isocodes)[udokmeci/yii2-phone-validator

Modern Yii2 Phone validator wrapper on top of PhoneNumberUtil library also used by Android devices

36224.9k1](/packages/udokmeci-yii2-phone-validator)[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

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