Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ivantcholakov/egn

A PHP class for validation and generation of EGN (personal identification numbers for Bulgarian citizens)
https://github.com/ivantcholakov/egn

bulgarian-citizens egn php

Last synced: about 1 month ago
JSON representation

A PHP class for validation and generation of EGN (personal identification numbers for Bulgarian citizens)

Awesome Lists containing this project

README

        

Egn.php
=======

A PHP class for validation and generation of EGN (personal identification numbers for Bulgarian citizens)

Examples:

```php
// EGN generation, for testing purposes.
$egn = Egn::generate();
echo $egn;
// Sample result: 9509125507
// The result is a random valid EGN, not necessarily a real person posseses it.

echo '
';

$egn = '9306295605';
$is_valid = Egn::valid($egn);
// $is_valid should be TRUE as a result.
echo $egn.' - '.($is_valid ? 'Valid' : 'Invalid');

echo '
';

$egn = '9306295606';
$is_valid = Egn::valid($egn); // Boolean result
// $is_valid should be FALSE as a result.
echo $egn.' - '.($is_valid ? 'Valid' : 'Invalid');

echo '
';

$egn = '9306295605';
$burthday = Egn::get_birthday($egn);
// $burthday should be 1993-06-29
echo $egn.' - Birthday is '.$burthday;

echo '
';

$egn = '9306295605';
$gender = Egn::get_gender($egn);
// $gender should be 'm' as a result ('m' for male, 'f' for female).
echo $egn.' - Gender is '.$gender;

echo '
';
```

Links:

http://georgi.unixsol.org/programs/egn.php

http://georgi.unixsol.org/diary/archive.php/2006-09-29