PHPackages                             djunehor/validate\_nigerian\_phone - 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. djunehor/validate\_nigerian\_phone

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

djunehor/validate\_nigerian\_phone
==================================

A PHP module to validate and format a Nigerian phone number as well as deduce the network provider or area code.

6565[1 issues](https://github.com/djunehor/php_validate_nigerian_phone/issues)PHPCI failing

Since Oct 14Pushed 6y ago1 watchersCompare

[ Source](https://github.com/djunehor/php_validate_nigerian_phone)[ Packagist](https://packagist.org/packages/djunehor/validate_nigerian_phone)[ RSS](/packages/djunehor-validate-nigerian-phone/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Nigerian Phone Number Validator (PHP) [![HitCount](https://camo.githubusercontent.com/cbce28838cf0168523f7266202118c94acf0fd02f263980527e1abe64d63c85e/687474703a2f2f686974732e6477796c2e696f2f646a756e65686f722f7068705f76616c69646174655f6e6967657269616e5f70686f6e652e737667)](http://hits.dwyl.io/djunehor/php_validate_nigerian_phone) [![CircleCI](https://camo.githubusercontent.com/b72251d5067961dd2840341de524112f7d7c05425297b12de1a6674a30d170f9/68747470733a2f2f636972636c6563692e636f6d2f67682f646a756e65686f722f7068705f76616c69646174655f6e6967657269616e5f70686f6e652e7376673f7374796c653d737667)](https://circleci.com/gh/djunehor/php_validate_nigerian_phone)

#### Issues and pull requests welcome.

[](#issues-and-pull-requests-welcome)

A PHP module to validate and format a Nigerian phone number as well as deduce the network provider or area code.

NOTE: The network resolution function can't be accurate because Nigeria implemented [Mobile Number Portability](https://en.wikipedia.org/wiki/Mobile_number_portability) in 2013, so the number prefix cannot be reliably used to determine operator anymore.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#note-the-network-resolution-function-cant-be-accurate-because-nigeria-implemented-mobile-number-portability-in-2013-so-the-number-prefix-cannot-be-reliably-used-to-determine-operator-anymore)

### Table of Contents

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [Features](#features)
- [Contribute](#contribute)
- [Run Tests](#tests)

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

[](#installation)

You will need &gt;[PHP 5.6](https://www.php.net/) and [composer](https://getcomposer.org/download/).

Install using composer: `composer require djunehor/validate_nigerian_phone`

### In a Laravel project

[](#in-a-laravel-project)

- If using Laravel 5.5 and above, no further action required
- If you're using Laravel &lt; 5.5, you'll need to register the service provider. Open up config/app.php and add the following to the providers array: `Djunehor\Validator\PhoneValidatorServiceProvider::class`

Usage
-----

[](#usage)

### In Laravel

[](#in-laravel)

```
...

/*This checks if the number supplied
*is a valid nigerian number
* either land line or mobile number
*/
public function controllerName(Request $request) {
		$request->validate( [
			'phone' => 'required|ngphone'
		]);
	}

//to validate if it's a mobile number
$request->validate( [
			'phone' => 'required|ngphone:mobile'
		]);

//to validate if it's a landline
$request->validate( [
			'phone' => 'required|ngphone:land'
		]);
```

In a PHP project
================

[](#in-a-php-project)

If autoload is not enabled, add `require vendor/autoload.php` to the top of the file, then

```
use \Djunehor\Validator\NigerianPhone;

$phone = new NigerianPhone('+2348135087966');

// Check if is valid
$phone->isValid(); // true

// Get formatted
$phone->formatted(); // 08135087966

// Get Network
$phone->getNetwork(); // mtn

// Check if is mtn
$phone->isMtn(); // True

// Get network from phone number prefix e.g
$phone->getNetworkByPrefix('0703'); // mtn
```

Features
--------

[](#features)

### Currently implemented

[](#currently-implemented)

- isValid
- formatted
- getNetwork
- getAreaCode
- isMtn
- isGlo
- isAirtel
- is9mobile
- isSmile
- isMultilinks
- isVisafone
- isNtel
- isStarcomms
- isZoom
- getPrefixesByNetwork
- getNetworkByPrefix
- getAreaCodeByName

### Tests

[](#tests)

- Run `phpunit tests/NigerianPhoneTest.php`

Contribute
----------

[](#contribute)

Check out the issues on GitHub and/or make a pull request to contribute!

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![djunehor](https://avatars.githubusercontent.com/u/20708833?v=4)](https://github.com/djunehor "djunehor (9 commits)")

### Embed Badge

![Health badge](/badges/djunehor-validate-nigerian-phone/health.svg)

```
[![Health](https://phpackages.com/badges/djunehor-validate-nigerian-phone/health.svg)](https://phpackages.com/packages/djunehor-validate-nigerian-phone)
```

###  Alternatives

[webmozart/assert

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

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[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)
