https://github.com/renekorss/personal-id-code-php
Estonian personal ID code validator and processor
https://github.com/renekorss/personal-id-code-php
estonia isikukood personal-code personal-id-code personal-identification-code php
Last synced: about 1 month ago
JSON representation
Estonian personal ID code validator and processor
- Host: GitHub
- URL: https://github.com/renekorss/personal-id-code-php
- Owner: renekorss
- License: mit
- Created: 2018-10-25T05:40:24.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-28T18:17:18.000Z (over 3 years ago)
- Last Synced: 2025-04-20T09:18:20.776Z (about 1 month ago)
- Topics: estonia, isikukood, personal-code, personal-id-code, personal-identification-code, php
- Language: PHP
- Homepage: https://renekorss.github.io/personal-id-code-php/
- Size: 882 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/renekorss/personal-id-code-php/actions)
[](https://coveralls.io/github/renekorss/personal-id-code-php?branch=master)
[](https://www.codacy.com/app/renekorss/personal-id-code-php?utm_source=github.com&utm_medium=referral&utm_content=renekorss/personal-id-code-php&utm_campaign=Badge_Grade)
[](https://packagist.org/packages/renekorss/personal-id-code-php)
[](https://packagist.org/packages/renekorss/personal-id-code-php)
[](LICENSE)# Personal ID code
Estonian personal ID code validator and processor## Install
````bash
composer require renekorss/personal-id-code-php
````## Usage
````php
use RKD\PersonalIdCode\PersonalIdCode;$id = new PersonalIdCode('39002102761');
// These results are examples as of 2018-11-26
echo $id->getGender(); // male$datetime = $id->getBirthDate(); // Datetime object
echo $datetime->format('Y-m-d'); // 1990-02-10echo $id->getAge(); // 28
echo $id->getBirthCentury(); // 1900// Birth year in different formats
echo $id->getBirthYear(); // 1990
echo $id->getBirthYear('y'); // 90// Birth month in different formats
echo $id->getBirthMonth(); // 02
echo $id->getBirthMonth('M'); // Feb
echo $id->getBirthMonth('F'); // February// Birth day in different formats
echo $id->getBirthDay(); // 10
echo $id->getBirthDay('D'); // Sat
echo $id->getBirthDay('l'); // Saturday// Presumable hospital where person was born
echo $id->getHospital(); // Maarjamõisa Kliinikum (Tartu), Jõgeva Haigla// Check validity
if ($id->validate()) {
echo 'Valid personal ID code';
} else {
echo 'Invalid personal ID code';
}
````## Tasks
- `composer build` - build by running tests and all code checks
- `composer tests` - run tests
- `composer format` - format code against standards
- `composer docs` - build API documentation
- `composer phpmd` - run PHP Mess Detector
- `composer phpcs` - run PHP CodeSniffer## License
Licensed under [MIT](LICENSE)