tohmua/slk581

Generate SLK581 codes

v0.1.0 2016-11-22 19:20 UTC

This package is not auto-updated.

Last update: 2024-04-13 23:05:39 UTC


README

Build Status

SLK581

This project generates SLK581 Codes. More info on SLK581 codes can be found here. More detailed notes on the specification can be found here.

Install

composer require tohmua/slk581

Use

$slk581 = new SLK581\SLK581();

$slk581->generate(
    $firstName   = 'firstname',
    $lastName    = 'lastname',
    $dateOfBirth = '11/11/2016', // must be formatted dd/mm/yyyy
    $gender      = 2             // see documentation or 'src/Fields/Interfaces/Gender.php' for gender codes
); // ASNIR111120162

Errors

generate() method returns a string of a valid SLK581 code on success or FLASE on Failure.

To get the error message you can call the errorMessage() method.

$slk581 = new SLK581\SLK581();

$slk581->generate(
    $firstName   = 'firstname',
    $lastName    = 'lastname',
    $dateOfBirth = '',
    $gender      = 2
); // (bool) FALSE

$slk581->errorMessage(); //SLK581 Error: No Date of Birth supplied. This is required.

Tests

To run: composer test

The code coverage report can be found in tests/_output however this is git ignored but it will be generated automatically for you when you run the test suite.