1. Go to this page and download the library: Download nigrosimone/codicefiscale library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nigrosimone / codicefiscale example snippets
NigroSimone\CodiceFiscale;
$cf = new CodiceFiscale();
if( $cf->validaCodiceFiscale('MRARSS75P14H501I') )
echo 'Codice fiscale corretto';
else
echo 'Codice fiscale non corretto';
$comuni = ['H501', 'F205', 'L219', 'Z133']; // il tuo elenco
$cf = new CodiceFiscale();
$cf->setValidatoreComune(function (string $comune) use ($comuni): bool {
return in_array($comune, $comuni, true);
});
$cf->validaCodiceFiscale('MRARSS75P14H501I'); // true
$cf->validaCodiceFiscale('MRARSS75P14A999N'); // false, "Codice del comune non valido"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.