PHP Classes
elePHPant
Icontem

PHP Validate Nigerian Phone: Parse and validate Nigeria phone numbers

Recommend this page to a friend!
  Info   View files Documentation   View files View files (17)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-10-10 (1 month ago) RSS 2.0 feedNot yet rated by the usersTotal: 28 All time: 9,735 This week: 357Up
Version License PHP version Categories
php_validate_nigeria 1.0Custom (specified...5PHP 5, Validation
Description Author

This class can parse and validate Nigeria phone numbers.

It can take a string of given phone number from Nigeria and parses it to check if it is valid.

The class can also reformat the phone number string, return the area code name and phone carrier network name.

It can also check if a number contains the name network, as well get the network name by number prefix.

  Performance   Level  
Name: Zacchaeus Bolaji <contact>
Classes: 6 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 1x

 

Details

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

Installation

You will need PHP 7.x and composer.

Install using composer: composer require djunehor/validate_nigerian_phone

Usage

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

Currently implemented

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

Tests

  • Run phpunit tests/NigerianPhoneTest.php

Contribute

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

  Files folder image Files  
File Role Description
Files folder image.circleci (1 file)
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file CODE_OF_CONDUCT.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file CONTRIBUTING.md Data Auxiliary data
Accessible without login Plain text file ISSUE_TEMPLATE.md Data Auxiliary data
Accessible without login Plain text file LICENSE.md Lic. License text
Accessible without login Plain text file phpcs.xml.dist Data Auxiliary data
Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data
Accessible without login Plain text file PULL_REQUEST_TEMPLATE.md Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .circleci  
File Role Description
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file NigerianPhone.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file NigerianPhoneTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:28
This week:0
All time:9,735
This week:357Up