Download the PHP package coreproc/msisdn-ph without Composer
On this page you can find all versions of the php package coreproc/msisdn-ph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download coreproc/msisdn-ph
More information about coreproc/msisdn-ph
Files in coreproc/msisdn-ph
Package msisdn-ph
Short Description An MSISDN identification and cleaner library for Philippine telco subscribers
License MIT
Homepage http://github.com/coreproc/msisdn-ph-php
Informations about the package msisdn-ph
MsisdnPH - PHP
Easily validate and manipulate Philippine mobile numbers.
Table of contents
- Install
- Usage
- Validate the mobile number
- Instantiate an MSISDN object
- Return a standardized format of your mobile number
- Get the telco operator of a mobile number
- Get the prefix of a mobile number
- Validating mobile numbers using Laravel 5.1
- Credits
- License
Install
Run the following command at the root of your project (assuming you have Composer and a composer.json file already)
Usage
Validate the mobile number
The validate
method cleans the given mobile number and validates it so even if the mobile number is malformed or has other characters within it, it will still return true as long as the number is really valid:
Instantiate an MSISDN object
You can instantiate an MSISDN object and get a standardized format of your mobile number and even get the telco attached to the mobile number using this object.
The MSISDN object will throw an InvalidMsisdnException
if you give it an invalid mobile number, so it's best to either catch the exception OR validate it before creating an MSISDN object.
OR
Return a standardized format of your mobile number
When you've instantiated an Msisdn
object, you can return the mobile number in any format you want.
Get the telco operator of a mobile number
You can also get the telco operator of the given mobile number - this is based on the included prefixes we have gathered from the telcos.
We cannot guarantee that this list is updated so use with a grain of salt.
If you want to add to the prefixes, you can find the list inside the src/prefixes
directory.
Get the prefix of a mobile number
You might just want to get the prefix of a mobile number.
Validating mobile numbers using Laravel 5.1
You can easily integrate this into Laravel's validator class by adding the line below to the default AppServiceProvider
located in the app/Providers
directory.
Inside the boot()
method, add the following line:
Credits
- Chris Bautista
- All Contributors
About CoreProc
CoreProc is a software development company that provides software development services to startups, digital/ad agencies, and enterprises.
Learn more about us on our website.
License
The MIT License (MIT). Please see License File for more information.
All versions of msisdn-ph with dependencies
ext-json Version *