定制 davidianbonner/cli-phone-number-validator 二次开发

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

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

davidianbonner/cli-phone-number-validator

Composer 安装命令:

composer require davidianbonner/cli-phone-number-validator

包简介

CLI Phone Number Validator using Google's libphonenumber.

README 文档

README

Author Build Status Quality Score Software License Packagist Version Coverage Status

Installation

Install the application with composer:

$ composer create-project davidianbonner/cli-phone-number-validator

To create a standalone PHAR of the application for deployment, run:

$ php number-validator app:build number-validator

This will output a .PHAR to the build directory.

Usage

The validator comes with a pre-built GB & Channel Islands mobile command: validate:uk-mobile. There are two ways to process and validate numbers:

List source

Pass a list of phone numbers to the validator.

$ php number-validator validate:uk-mobile "07712345678" "07712341234" "07283 123 32"
File source

Pass a file with a phone number per-line.

$ php number-validator validate:uk-mobile ./path/to/file --file
Output directory

An output directory is required when using the standalone .PHAR:

$ php number-validator validate:uk-mobile ./path/to/file --file --output=/path/to/output/directory

Adding new validators

New validators can be added with minimal effort. First create a new command in app/Commands and extends the BaseValidatorCommand.

<?php

namespace App\Commands;

class ValidateESFixedLineCommand extends BaseValidatorCommand
{
    protected $signature = 'validate:es-fixedline
                            {source* : A list of numbers or files to validate against}
                            {--file : Specifies that the source is a list of files}
                            {--output= : Specifies that the output path}';

    protected $description = 'Validate Spanish fixed line numbers and ouput to a CSV';

    public function makeValidatorForNumer($number): PhoneNumberValidator
    {
        // The country code is only required when no dialing code is present in the number.
        return app(PhoneNumberValidator::class)->make($number, 'ES');
    }

    public function isNumberValid(PhoneNumberValidator $validator): bool
    {
        return ($validator->isValidFixedLine() && $validator->isValidForCountry('ES'));
    }
}

License

CLI Phone Number Validator is an open-sourced software licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-11-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固