PHP Classes


Recommend this page to a friend!
  Classes of Zacchaeus Bolaji  >  PHP Validate Nigerian Phone  >  >  Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Validate Nigerian Phone
Parse and validate Nigeria phone numbers
Author: By
Last change:
Date: 3 years ago
Size: 1,615 bytes


Class file image Download

Nigerian Phone Number Validator (PHP) HitCount CircleCI

Issues and pull requests welcome.

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

Table of Contents


You will need PHP 7.x and composer.

Install using composer: composer require djunehor/validate_nigerian_phone


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


Currently implemented

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


  • Run `phpunit tests/NigerianPhoneTest.php`


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