Recently I had to validate an UIC for BULSTAT for a project of mine, but I couldn’t find an implementation in PHP that would satisfy my need. And since the algorithm is described here (in Bulgarian, sorry), I decided to exercise a bit and write it out?
Being a good man, I made a composer package, which can easily be used from other people and projects. I needed it to work with Laravel’s Validator, so I wrote a second package which provides an extension for the Validator.
This is the usage of the validator itself:
<?php require __DIR__ . '/vendor/autoload.php'; $validator = new Mirovit\EIKValidator\EIKValidator; $validator->isValid('123123123');
Adding it to Laravel consists of adding a service provider in your config/app.php:
now you can define two new validation rules, which do the same thing – eik and bulstat.
I hope it would be useful for someone!