fattureincloud / codice-fiscale
一个用于计算和验证意大利税务代码(codice fiscale)有效性的库
dev-master
2023-03-29 16:37 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- phpunit/phpunit: @stable
This package is auto-updated.
Last update: 2024-08-29 19:59:42 UTC
README
一个用于计算和验证意大利税务代码(codice fiscale)的库。基于andreausu的原始工作,并由fdisotto贡献。
需求
- php >= 5.4
安装
使用以下命令添加库
composer require fattureincloud/codice-fiscale
使用方法
<?php require_once __DIR__ . '/vendor/autoload.php'; use CodiceFiscale\Calculator; use CodiceFiscale\Checker; $calc = new Calculator(); $calc->calcola('Nome', 'Cognome', 'M', new \DateTime('1992-03-06'), 'F205'); $chk = new Checker(); if ($chk->isFormallyCorrect('RSSMRA79S18F205J')) { print('Codice Fiscale formally correct'); printf('Birth Day: %s', $chk->getDayBirth()); printf('Birth Month: %s', $chk->getMonthBirth()); printf('Birth Year: %s', $chk->getYearBirth()); printf('Birth Country: %s', $chk->getCountryBirth()); printf('Sex: %s', $chk->getSex()); } else { print('Codice Fiscale wrong'); }
测试
该库已使用PHPUnit进行全面测试。
进入根目录,使用composer安装开发依赖项,然后运行phpunit测试套件
$ composer --dev install $ ./vendor/bin/phpunit