承接 tnmdev/msisdn-helpers 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tnmdev/msisdn-helpers

最新稳定版本:v1.4.0

Composer 安装命令:

composer require tnmdev/msisdn-helpers

包简介

MSISDN Helpers

README 文档

README

Phone number formatters and validator for all Mobile Networks in Malawi

How to install

composer require tnmdev/msisdn-helpers

Creating new number

MSISDN factory creates an instance of interface IMSISDN for any operator (new MsisdnFactory('0888800900'))->make(); of TNM\Msisdn namespace

The make method returns an instance of MSISDN interface or throws MsisdnException of TNM\Msisdn namespace if the value passed is not a valid Malawian phone number

You can also use msisdn('+265999900900') which aliases to the MSISDN factory

The factory strips out all spaces and special characters, so any of the following formats will be recognised as Malawian phone numbers: 0888800900, 265888800900, +265888800900, +265 888 800 900, +265 888 80 09 00, 0888-800-900,

FAN FACT: Even if you put a movie within the phone number, it will be parsed as a valid number 😛

Formatters

Humanize

msisdn('265-888-800-900')->humanize();
// returns 0888800900

Internationalize

msisdn('01800900')->internationalize();
// returns 2651800900

To add the international format prefix + symbol, pass true to internationalize

msisdn('01800900')->internationalize(true);
// returns +2651800900

Base string

msisdn('0999800900')->toString();
// returns 999800900

Validators

Valid TNM Number

is_valid_tnm_number('01800900');
// returns false 

Valid Malawian Number

is_valid_malawian_number('01800900');
// returns true

Valid MTL Number

use TNM\Msisdn\Operators\MTLMsisdn;

msisdn('0999800900') instanceof MTLMsisdn;
// return false

msisdn('01800900') instanceof MTLMsisdn;
// return true

With the method above, you can validate other classes: TNM\Msisdn\Operators\AirtelMsisdn and TNM\Msisdn\Operators\AccessMsisdn

Testing

phpunit tests

统计信息

  • 总下载量: 2.49k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-05