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)6125[1 PRs](https://github.com/dammynex/ngr-phone-validator/pulls)Apache-2.0PHPCI passing

Since Jun 23Pushed 3w 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 today

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

41

—

FairBetter than 89% of packages

Maintenance70

Regular maintenance activity

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

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

536d 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

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[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

8013.3M23](/packages/ronanguilloux-isocodes)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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