PHP code example of lytrax / afm

1. Go to this page and download the library: Download lytrax/afm library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lytrax / afm example snippets


use function Lytrax\AFM\validateAFM;
use function Lytrax\AFM\generateAFM;
use function Lytrax\AFM\generateValidAFM;
use function Lytrax\AFM\generateInvalidAFM;

validateAFM('090000045');
bool(true)

validateAFM('123456789');
bool(false)

generateValidAFM();
string(9) "731385437"

generateInvalidAFM();
string(9) "853003357"

validateAFM('ab1234', ['extendedResult' => true]);
array(2) {
  ["valid"]=>
  bool(false)
  ["error"]=>
  string(6) "length"
}

generateAFM([
  'forceFirstDigit' => 3,
  'repeatTolerance' => 1,
  'valid' => true
]);
string(9) "335151580"

generateValidAFM(['pre99' => true]);
string(9) "070825250"

generateInvalidAFM(['legalEntity' => true]);
string(9) "877577341"

git clone https://github.com/clytras/afm-php.git && cd afm-php
composer install
./vendor/bin/phpunit --testdox

php ./demo/index.php