2017 © Pedro Peláez
 

library cli-phone-number-validator

CLI Phone Number Validator using Google's libphonenumber.

image

davidianbonner/cli-phone-number-validator

CLI Phone Number Validator using Google's libphonenumber.

  • Friday, November 17, 2017
  • by davidianbonner
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

A CLI Phone Number Validator

Author Build Status Quality Score Software License Packagist Version Coverage Status, (*1)

Installation

Install the application with composer:, (*2)

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

To create a standalone PHAR of the application for deployment, run:, (*3)

$ php number-validator app:build number-validator

This will output a .PHAR to the build directory., (*4)

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:, (*5)

List source

Pass a list of phone numbers to the validator., (*6)

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

Pass a file with a phone number per-line., (*7)

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

An output directory is required when using the standalone .PHAR:, (*8)

$ 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., (*9)

<?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., (*10)

The Versions

17/11 2017

dev-master

9999999-dev

CLI Phone Number Validator using Google's libphonenumber.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework console zero

17/11 2017

1.0.3

1.0.3.0

CLI Phone Number Validator using Google's libphonenumber.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework console zero

17/11 2017

1.0.2

1.0.2.0

CLI Phone Number Validator using Google's libphonenumber.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework console zero

17/11 2017

1.0.1

1.0.1.0

CLI Phone Number Validator using Google's libphonenumber.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework console zero

17/11 2017

1.0.0

1.0.0.0

CLI Phone Number Validator using Google's libphonenumber.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel framework console zero