nhed/avs

dev-master / 1.0.x-dev 2018-07-27 00:58 UTC

This package is auto-updated.

Last update: 2019-02-27 02:29:27 UTC


README

Install

Via Composer :

$ composer require nhedger/avs

Usage

use Nhedger\Avs\Avs;
use Nhedger\Avs\Exception\InvalidAvsNumberException;

// Generating an AVS/AHT number
$avs = Avs::generate()

// Generating an AVS/AHT number with a custom country code
$avs = Avs::generate("123");

// Validating an AVS/AHT number
try {
    Avs::validate($avs);
} catch (InvalidAvsNumberException $e) {
    printf($e->getMessage());
}

// Creating a new AVS/AHT number (automatic validation)
try {
    $avs = new Avs("756.1234.5678.97");
} catch (InvalidAvsNumberException $e) {
    printf($e->getMessage());
}

Testing

$ composer test

License

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