Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fisss-apprentice/ulntools
Unique Learner Number (ULN) validator to validate as per the specification published
https://github.com/fisss-apprentice/ulntools
composer php validation
Last synced: about 2 months ago
JSON representation
Unique Learner Number (ULN) validator to validate as per the specification published
- Host: GitHub
- URL: https://github.com/fisss-apprentice/ulntools
- Owner: FISSS-Apprentice
- License: mit
- Created: 2021-04-06T15:43:55.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-05-10T09:00:20.000Z (over 2 years ago)
- Last Synced: 2024-09-18T10:19:48.417Z (5 months ago)
- Topics: composer, php, validation
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ulnTools
ULN (Unique Learner Number) tools to validate a uln as per the specification at
https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/710270/ULN_validation.pdfThe validator first checks if the ULN is in the correct format then calculates the checksum.
Usage:
install with composer
```
composer require fisss-apprentice/ulntools
```then use in a file
```php
getMessage() ."\n";
}if (!$ulnValid) {
die('uln is not valid '.$errorMessage);
}// too few digits
$testUln=100010250;
$ulnValid = false;
$errorMessage = '';
try {
$ulnValid = UlnValidation::validate($testUln);
} catch (Exception $e) {
$errorMessage = $e->getMessage() ."\n";
}if (!$ulnValid) {
die('uln is not valid '.$errorMessage);
}```
UlnValidation::validate returns true if a valid uln is provided
an exception is thrown with more detail about problem contained in the exception message