定制 helip/phonenumber 二次开发

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

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

helip/phonenumber

Composer 安装命令:

composer require helip/phonenumber

包简介

a library to manage belgian phone numbers

README 文档

README

Helip PhoneNumber is a simple PHP library for validating and formatting phone numbers. This library supports identifying phone number types (mobile, fixed) and converting phone numbers to their international format.

Limitations

Currently, the library only formats and validates Belgian phone numbers. International countries currently recognized but not formatted: FR, DE, NL, LU, CH, AT, IE, GB, LI

Installation

To install the library, use Composer:

composer require helip/phonenumber

Usage

Basic Example

use Helip\PhoneNumber\PhoneNumber;
use Helip\PhoneNumber\Exceptions\InvalidPhoneNumberException;

try {
    $phoneNumber = new PhoneNumber('+32471234567');
    echo $phoneNumber->getInternationalFormat(); // Output: +32 471 234 567
    echo $phoneNumber->getCountryCode(); // Output: BE
    echo $phoneNumber->getType(); // Output: PhoneNumberModel::TYPE_MOBILE
} catch (InvalidPhoneNumberException $e) {
    echo 'Invalid phone number.';
}

Features

  • Phone Number Validation: Checks if a phone number is valid and matches the expected format.
  • Country Code Detection: Identifies the country based on the phone number. Currently supports Belgian phone numbers.
  • Phone Number Type Detection: Differentiates between mobile and fixed phone numbers.
  • International Format: Converts phone numbers to a standardized international format.

Running Tests

This library includes PHPUnit tests to validate its functionality. You can run the tests by executing:

vendor/bin/phpunit

Contributing

Feel free to submit issues and pull requests. Make sure to follow the coding standards using PHPStan and PHP CS Fixer.

License

This library is licensed under the LGPL-3.0-or-later license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2024-09-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固