zerochip/zimcell
Composer 安装命令:
composer require zerochip/zimcell
包简介
A package for verifying providers for Zimbabwean phone numbers
README 文档
README
Overview
A package for working with Zimbabwean phone numbers. You can verify if a phone number belongs to a network or get the provider it belongs to.
Demo
You can see it in action here https://zimcell.herokuapp.com
Installation
composer require zerochip/zimcell
Usage
First import the class into your file
use Zerochip\Zimcell
Methods
refine
refine($cellnumber)
Cleans up the cell number of any legiblity helpers by removing the following:
- Spaces
- Country code (+263 or 263)
- The leading zero
Zimcell::refine('+263772 123 456'); Zimcell::refine('263772 123456'); Zimcell::refine('0772 123 456'); Zimcell::refine('0772123456'); // All the above return 772123456
intlFormat
intlFormat($cellnumber)
Internationalizes the phone number with a "+" prefix.
Zimcell::intlFormat('0772 123 456'); // return +263772123456
valid
valid($cellnumber)
Checks if the given cellnumber is a valid Zimbabwean number by:
- running the refine function
- checking if the refined number is 9 digits long
- checking if the refined number starts with a 7
ZimCell::valid('0772 123 456'); // returns true ZimCell::valid('0872 12 34 56'); //returns false, refined number starts with an 8 i.e 872123456 Zimcell::valid('0772 12345'); // returns false, refined number will be 8 digits long i.e 77212345
is
is($provider, $cellnumber)
Verifies if a number belongs to a given provider or service. The case of the provider name does not matter since they are converted to lower case before verifying.
Zimcell::is('econet', '0772 123 456'); // returns true Zimcell::is('teleCash', '0772 123 456'); // returns false, note use of camelCase for provider name Zimcell::is('netcel', '0772 123 456'); // returns null, netcel is not a supported provider
Supported provider and service names are as follows:
- Econet
- EcoCash
- Telecel
- Telecash
- NetOne
- One Money
getProvider
getProvider($cellnumber)
returns the provider for a phone number.
Zimcell::getProvider('0712123456'); // returns netone Zimcell::getProvider('0812123456'); // returns null
zerochip/zimcell 适用场景与选型建议
zerochip/zimcell 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25 次下载、GitHub Stars 达 2, 最近一次更新时间为 2018 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 zerochip/zimcell 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zerochip/zimcell 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-25