adevpmftc/msisdn-ph
Composer 安装命令:
composer require adevpmftc/msisdn-ph
包简介
An MSISDN identification and cleaner library for Philippine telco subscribers
README 文档
README
Easily validate and manipulate Philippine mobile numbers.
Table of contents
Install
Run the following command at the root of your project (assuming you have Composer and a composer.json file already)
composer require adevpmftc/msisdn-ph "^1.0"
Usage
Validate the mobile number
$mobileNumber = '09171231234'; if (Msisdn::validate($mobileNumber)) { echo 'Valid mobile number'; } else { echo 'Invalid 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:
$validMobileNumber = '+639171231234'; $validMobileNumber = '+63-917-123-1234'; $validMobileNumber = '0917-123-1234'; $validMobileNumber = '0917.123.1234'; $validMobileNumber = '63 917 123 12 34 ';
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.
$mobileNumber = '09171231234'; $msisdn = new Msisdn($mobileNumber);
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.
$invalidMobileNumber = '0917-123-123'; try { $msisdn = new Msisdn($invalidMobileNumber); } catch (InvalidMsisdnException $e) { echo 'The number is invalid'; return; }
OR
$invalidMobileNumber = '0917-123-123'; if (Msisdn::validate($invalidMobileNumber)) { $msisdn = new Msisdn($invalidMobileNumber); } else { echo 'Invalid mobile number'; return; }
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.
$mobileNumber = '09171231234'; $msisdn = new Msisdn($mobileNumber); echo $msisdn->get(); // will return 09171231234 echo $msisdn->get(true); // will return +639171231234 echo $msisdn->get(false, '-'); // will return 0917-123-1234 echo $msisdn->get(true, '-'); // will return +63-917-123-1234 echo $msisdn->get(true, '.'); // will return +63.917.123.1234
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.
$mobileNumber = '09171231234'; $msisdn = new Msisdn($mobileNumber); echo $msisdn->getOperator(); // will return Globe
Get the prefix of a mobile number
You might just want to get the prefix of a mobile number.
$mobileNumber = '09171231234'; $msisdn = new Msisdn($mobileNumber); echo $msisdn->getPrefix(); // will return 917
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:
Validator::extend('msisdn', function ($attribute, $value, $parameters) { return AdevPmftc\MsisdnPh\Msisdn::validate($value); });
Credits
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.
adevpmftc/msisdn-ph 适用场景与选型建议
adevpmftc/msisdn-ph 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「smart」 「msisdn」 「msisdn philippines」 「globe」 「sun」 「mobile number」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 adevpmftc/msisdn-ph 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 adevpmftc/msisdn-ph 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 adevpmftc/msisdn-ph 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
An MSISDN identification and cleaner library for Philippine telco subscribers
Philippines region, province, cities/municipalities and barangays Laravel migration and table seeder.
Tuya cloud api home management php client
PHP library for consuming Infobip's API
Ethereum Client Library For Laravel
Infobip SMS library for PHP
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-12