PHPackages                             ivanomatteo/codice-fiscale - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ivanomatteo/codice-fiscale

ActiveLibrary

ivanomatteo/codice-fiscale
==========================

Calculation and data extraction on italian fiscal code (codice fiscale), with "omocodie" and diacritical character esapnsion (caratteri diacritici)

0.1.9(5y ago)045.5k↓16.5%11MITPHPPHP &gt;=5.6

Since Jul 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ivanomatteo/codice-fiscale)[ Packagist](https://packagist.org/packages/ivanomatteo/codice-fiscale)[ Docs](https://github.com/ivanomatteo/codice-fiscale)[ RSS](/packages/ivanomatteo-codice-fiscale/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (11)Used By (1)

codice fiscale
==============

[](#codice-fiscale)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0888361985413fb4cc800fca2800046199f15d5d331452b840609fc28b56aab3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6976616e6f6d617474656f2f636f646963652d66697363616c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanomatteo/codice-fiscale)[![Total Downloads](https://camo.githubusercontent.com/b8cce2d8813c73fb62d2d445a94cc798b67d43347e9923ee176c68cea6d2085b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6976616e6f6d617474656f2f636f646963652d66697363616c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivanomatteo/codice-fiscale)

Calculation and data extraction on italian fiscal code (codice fiscale), with "omocodie".

It also support diacritical character expansion (caratteri diacritici) for example:

'Ä' =&gt; 'AE', 'ß' =&gt; 'SS'

...

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require ivanomatteo/codice-fiscale
```

Usage
-----

[](#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

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Ivano Matteo](https://github.com/ivanomatteo)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~50 days

Total

10

Last Release

1942d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35255310?v=4)[Ivano Matteo](/maintainers/IvanoMatteo)[@ivanomatteo](https://github.com/ivanomatteo)

---

Top Contributors

[![ivanomatteo](https://avatars.githubusercontent.com/u/35255310?v=4)](https://github.com/ivanomatteo "ivanomatteo (15 commits)")[![fullbl](https://avatars.githubusercontent.com/u/8133457?v=4)](https://github.com/fullbl "fullbl (9 commits)")

---

Tags

ivanomatteocodicefiscaleomocodiadiacritici

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ivanomatteo-codice-fiscale/health.svg)

```
[![Health](https://phpackages.com/badges/ivanomatteo-codice-fiscale/health.svg)](https://phpackages.com/packages/ivanomatteo-codice-fiscale)
```

###  Alternatives

[ivanomatteo/laravel-device-tracking

a library that allow to track different devices used

28160.7k](/packages/ivanomatteo-laravel-device-tracking)[ivanomatteo/laravel-scout-fulltext-engine

A scout DB fulltext-based driver that store index data in related tables

101.1k](/packages/ivanomatteo-laravel-scout-fulltext-engine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
