定制 renderbit/normalize-phone 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

renderbit/normalize-phone

最新稳定版本:v2.0.0

Composer 安装命令:

composer require renderbit/normalize-phone

包简介

Normalize phone numbers (with or without country code)

README 文档

README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Normalize a phone number (with or without country code).

Background

We needed to send phone numbers to a third-party API as an amalgamation of the phone number and the country code, without the plus sign, brackets or any other special characters such as hyphens or spaces. We built this package as a solution to automatically parse user-input phone numbers and pass them as-is to the API, if already in the correct format - otherwise amend them and send the formatted numbers to the API.

This package looks for the environment variable PHONE_DEFAULT_COUNTRY_CODE to define the base country code to be prepended to the numbers with no country code. If no such variable is define, the package assumes a default of India (91).

Install

Via Composer

$ composer require renderbit/normalize-phone

Usage

normalize_phone('9434012345');        // '919434012345'
normalize_phone('+919434012345');     // '919434012345'
normalize_phone('+91-9434012345');    // '919434012345'
normalize_phone('+19434012345');      // '19434012345'
normalize_phone('+91 9434012345');    // '919434012345'
normalize_phone('(+91) 94340 12345'); // '919434012345'

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email “contact at renderbit dot com” instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-02-23