library msisdn
Msisdn number format, Prefixes are updated courtesy of https://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
allan/msisdn
Msisdn number format, Prefixes are updated courtesy of https://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
- Sunday, June 3, 2018
- by allan
- Repository
- 1 Watchers
- 0 Stars
- 0 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
msisdn
This is a basic PHP 7 package that basically enforces the standard number format of 2547 prrefix of Kenyan based mobile numbers. The clean method also checks for the validity of an MSISDN number if given as 07XX, 7XX or 2547XX formats. Prefixes are updated courtesy of https://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya, (*1)
Installation
Download the package zip, extract and run, (*2)
composer install
Alternatively run:
composer require allan/msisdn
Examples
Get Channel
use Msisdn\Utility;
include 'vendor/autoload.php';
var_dump(Utility::getMobileNetworkOperator("+254 720 000000")); // string(9) "Safaricom"
var_dump(Utility::getMobileNetworkOperator("0720000000")); // string(9) "Safaricom"
var_dump(Utility::getMobileNetworkOperator("720000000")); // string(9) "Safaricom"
Clean MSISDN
use Msisdn\Utility;
include 'vendor/autoload.php';
var_dump(Utility::clean("+254 720 000000")); // int(254720000000)
var_dump(Utility::clean("0720000000")); // int(254720000000)
var_dump(Utility::clean("720000000")); // int(254720000000)
var_dump(Utility::clean("7200022")); // int(-1) invalid MSISDN format that cannot be sanitized
dev-master
9999999-dev
Msisdn number format, Prefixes are updated courtesy of https://en.wikipedia.org/wiki/Telephone_numbers_in_Kenya
Sources
Download
The Requires