ivanomatteo/codice-fiscale
最新稳定版本:0.1.9
Composer 安装命令:
composer require ivanomatteo/codice-fiscale
包简介
Calculation and data extraction on italian fiscal code (codice fiscale), with "omocodie" and diacritical character esapnsion (caratteri diacritici)
README 文档
README
Calculation and data extraction on italian fiscal code (codice fiscale), with "omocodie".
It also support diacritical character expansion (caratteri diacritici) for example:
'Ä' => 'AE', 'ß' => 'SS'
...
Installation
You can install the package via composer:
composer require ivanomatteo/codice-fiscale
Usage
include __DIR__.'/vendor/autoload.php'; use IvanoMatteo\CodiceFiscale\CodiceFiscale; try{ // will raise an exception if the format is not valid $c = CodiceFiscale::parse("RSSMRAULRL1H50MM",1900); // passing the "century" arg, help to validate in case of leap years $c = CodiceFiscale::parse("RSSMRAULRL1H50MM"); echo "\n"."matchName ".($c->matchName('Mario')? 'si' : 'no'); echo "\n"."isOmocodia ".($c->isOmocodia()? 'si' : 'no'); // to extract the date of birth, the "century" argumenti is required echo "\n"."getDateOfBirth ".$c->getDateOfBirth(1900)->format('Y-m-d'); // is possible to extract the raw date of birth: { "year":"yy", "month":"mm", "day":"dd" } echo "\n"."getDateOfBirthObj ".json_encode($c->getDateOfBirthRaw()); // the library can provide the nearest date of birth according to current date: echo "\n"."getProbableDateOfBirth ".$c->getProbableDateOfBirth()->format('Y-m-d'); // also according to minimum age and current date arguments echo "\n"."getProbableDateOfBirth 18 ".$c->getProbableDateOfBirth(18,'2019-01-01')->format('Y-m-d'); }catch(\Exception $ex){ echo $ex->getMessage(); } // // calculate using person data // $name = 'Mario'; $familyName = 'Rossi'; $dateOfBirth = '1980-10-01'; $sex = 'M'; $cityCode = 'H501'; $cf = CodiceFiscale::calculate($name, $familyName, $dateOfBirth, $sex, $cityCode); // // calcumate using an array (it accept an object as well) // $person = [ 'name' => $name, 'familyName' => $familyName, 'date' => $dateOfBirth, 'sex' => $sex, 'cityCode' => $cityCode, ]; $map = [ // it possible to provide a map, to match fields with different names 'dateOfBirth' => 'date' ]; $cfx = CodiceFiscale::calculateObj($person, $map); // generate all the 127 possible "omocodia" variations $variazioni = $cf->generateVariations(); // generate variation n. 7 only $variazioni = $cf->generateVariations(7);
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email ivanomatteo@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 40.06k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知