alwaysblank/rotary
Composer 安装命令:
composer require alwaysblank/rotary
包简介
Handle phone numbers.
README 文档
README
Simplify working with phone numbers.
Warning ⚠
Rotary will support numbers that look like the standard number format used in the United State of America, i.e. nnn-nnnn or nnn nnn-nnnn. These can also be prepended with an international country code up to 5 digit long, i.e. nn nnn nnn-nnnn. Numbers that deviate from this pattern cannot be reliably interpreted.
Usage 💪
Although all the internal behaviors are easily accessible (with the exception of the Number class, all methods are available as static methods), in general, you'll just be using these methods from the Render class:
prettywill result in(123) 456-7890or456-7890.simplewill result in123 456-7890or456-7890.hrefwill result intel:+11234567890ortel:+14567890.normalizedwill result in1234567890or567890.
You can call them like this:
use AlwaysBlank\Rotary\Render; echo Render::pretty('1234567890'); // (123) 456-7890 echo Render::pretty('123 456 7890'); // (123) 456-7890 echo Render::pretty('[123) 456/7890'); // (123) 456-7890
You can also instantiate a Rotary object, which has methods for the different format types:
use AlwaysBlank\Rotary\Rotary; $Rotary = new Rotary('123456789'); echo $Rotary->pretty(); // (123) 456-7890
This can be useful if you want access to several formats on one number.
You can put any non-digit characters you like in your argument and Rotary will simply ignore them--it cares only for digits.
234-5678and2dfsad__34-5)(6=78are identical so far as it's concerned.
Note: Rotary will try to interpret strange arguments, but it has limits, so please try to pass it numbers that make sense. 🙏
alwaysblank/rotary 适用场景与选型建议
alwaysblank/rotary 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.55k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2019 年 07 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alwaysblank/rotary 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alwaysblank/rotary 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.55k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-25