定制 salernolabs/phone 二次开发

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

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

salernolabs/phone

Composer 安装命令:

composer require salernolabs/phone

包简介

Utility for converting and formatting phone numbers

README 文档

README

This is just a teeny tiny tested library for parsing, formatting, and validating phone numbers.

It is mostly aimed towards US formatting as many countries and customs have their own form of formatting phone numbers.

Installation

Use composer

composer require salernolabs/phone

Instantiate a class as necessary!

General Usage

$phone = new \SalernoLabs\Phone\PhoneNumber('1234567890');
echo $phone->formatNumber();

If all works as expected this will output 1 (123) 456-7890

You can also just echo (string)$phone;

It implements \Serializable so it should be serializable.

Class Documentation

The class requires a valid phone number string to be entered as a constructor parameter. It is parsed at construction time. It may throw \InvalidArgumentException if it is unable to properly parse the phone number.

Method Inputs Outputs
constructor string Phone Number (required) -
getCountryCode - The parsed country code
getAreaCode - The parsed area code, empty string if none
getNumber - The parsed local phone number
getExtension - The parsed extension number if available
serialize - Returns the serialized representation of the number
unserialize string serialized version The unserialized version of the number

Contributing

Submit pull requests or fork it if you want. You are, after all, the Homerun Hitter of your Phone Number Formatter (sorry Chef John).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固