joemags-apps / zim-phone-utils
一个针对津巴布韦环境操作电话号码的Laravel包。
1.0.1
2024-05-25 22:20 UTC
Requires
- php: ^8.1
- giggsey/libphonenumber-for-php: ^8.13
- illuminate/contracts: ^10.0||^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
README
Zim Phone Utils是一个Laravel包,提供了一组用于在津巴布韦环境下操作电话号码的工具函数和自定义验证规则。它简化了如格式化电话号码、提取国家代码、确定移动运营商、以及根据特定标准验证电话号码等任务。
特性
- 以国家或国际格式格式化电话号码
- 从电话号码中提取国家ISO代码和国家代码
- 确定给定电话号码的移动运营商
- 电话号码和移动运营商的自定义验证规则
- 与Laravel验证系统的无缝集成
安装
您可以通过composer安装此包
composer require joemags-apps/zim-phone-utils
用法
use JoemagsApps\ZimPhoneUtils\Utils; // Format a phone number $formattedNumber = Utils::formatPhoneNumber('+263771234567'); // Get the country ISO code $countryIso = Utils::getCountryIso('+263771234567'); // Get the mobile carrier $carrier = Utils::getPhoneCarrier('+263771234567'); // Validate a phone number $request->validate([ 'phone' => 'required|phone:ZW', ]); // Validate a mobile carrier $request->validate([ 'carrier' => 'required|carrier:Econet,NetOne,Telecel', ]);
测试
composer test # Run tests
变更日志
有关最近变更的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
安全漏洞
请查看我们的安全策略,了解如何报告安全漏洞。
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。