Validating UIC for BULSTAT (Bulgaria)

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.

The code for the package can be found here and for the Laravel extension here.

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:

'Mirovit\EIKValidator\EIKValidatorServiceProvider',

now you can define two new validation rules, which do the same thing – eik and bulstat.

Links to Packgist.org: validator / Laravel package.

I hope it would be useful for someone!

Leave a Reply

Time limit is exhausted. Please reload CAPTCHA.