GithubHelp home page GithubHelp logo

laravel-codicefiscale's Introduction

Hi there 👋

My name is Roberto Gallea, I live in Italy and I am passionate about applying technology to many fields, such as multimedia, electronics, computer vision, woodworking and digital arts.

I am currently employed at the University of Palermo, Italy.

Language/Runtime : PHP, Python, Java, R, C/C++, ...

Framework/Libraries : Laravel, Symfony, Vue.js, React.js, Livewire, Flask, Django

I contribute to the OS community with some repositories and by giving talks and writing blog posts on my website and medium.

List of my talks (Italian language):

Follow me on:

laravel-codicefiscale's People

Contributors

bitthecat avatar caiojhonny avatar davidedelnista avatar jbou avatar makroxyz avatar michelepizzi avatar moroalberto avatar robertogallea avatar stylecibot avatar trippo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-codicefiscale's Issues

CheckForWrongCode

Why CheckForWrongCode isn't in private checks attribute in CodiceFiscale.php?

Samples in README not working

Detailed description

The code in the README on How to use the Utility CodiceFiscale class is outdated:
in case of error, CodiceFiscale::parse() returns false, and you will find information about the error using CodiceFiscale::getError(), which returns one of the defined constants among the following:

In reality, in case of an error, the parse method is throwing an exception. You have to catch the exception to get the errorcode and the getError method in the CodiceFiscale utility class is useless, the value is never set.

Context

For me, the code used in the README seems much cleaner than catching an exception. And when first using the library, the samples in the README were not working.

Possible implementation

Can you somehow change it to make it work like in the README, or add a second method tryParse which doesn't throw an exception?

carbon exception for some dates

if you have a cf like "LOIMLC71A77F979V" that generates an invalid date "37/01/1971" carbon will throw an exception when using the $cf->parse()

i suggest to add a test for invalid dates adding a new error code

Carbon\Exceptions\InvalidFormatException : Data missing

Detailed description

Il bug si verifica quando il campo "birthdate" ha una data incorretta (nel mio caso vuota), e viene triggerata la validazione.

Context

Evita questo errore.

Possible implementation

Si potrebbe controllare il formato della data che sia corretto secondo la configurazione impostata, pena esporre l'errore.

Grazie, ciao, e sempre buon lavoro!!!

InternationalCitiesStaticList

Hi, I noticed that this code doesn't use the InternationalCitiesStaticList class but Italian List. In this case I get errors when checking the CodiceFiscale when I use foreign birth states. For example Z133 from Switzerland.

Error su un codice

Su questo CF svrdvd73s26b665l
restituisce il seguente errore

[2021-07-19 16:07:09] production.ERROR: Undefined index: B665 {"exception":"[object] (ErrorException(code: 0): Undefined index: B665 at .../vendor/robertogallea/laravel-codicefiscale/src/CodiceFiscale.php:189)

Codice istat

Buongiorno,

è possibile usare il codice istat del comune anzichè il catastale per la validazione e la generazione del codice fiscale?

Grazie
Marco

Other Date Formats

Ciao,
innanzitutto ottimo lavoro!
Volevo chiederti se ci fosse la possibilità in una prossima release di gestire eventuali formati diversi di data (come d/m/Y) e per il sesso (insomma che sia configurabile).
Ad esempio io ho queste validazioni:
const VALIDATIONS = [ 'nome' => ['required'], 'cognome' => ['required'], 'tipo' => ['required'], 'sesso' => ['required'], 'datanascita' => ['required','date_format:d/m/Y'], 'luogonascita' => ['required'], 'provincianascita' => ['required'], 'statonascita' => ['required'], 'codicefiscale' => ['required','codice_fiscale:first_name=nome,last_name=cognome,birthdate=datanascita,place=luogonascita,gender=sesso'], 'cittadinanza' => ['required'], 'telefono' => ['required','numeric'], 'email' => ['required','email'], ];
e ovviamente non riesco ad utilizzare la funzionalità di controllo del codice fiscale in base ai campi in quanto la mia data non è in formato "Y-m-d" e il sesso lo ho in formato "Maschio" o "Femmina".
Grazie mille!

Regexp fails on Fiscal Code with Omocodia

Hello.
I have a fiscal code with omocodia, precisely L4L7 instead of L407 (Treviso).
It gives me an exception during the check CheckForWrongCode when using the regular expression in the page.

The fiscal code is: XXXXXX##X##L4L7T ( X for letters, # for numbers).

The regexp fails in the bold part:
/^[a-z]{6}[0-9]{2}[a-z][0-9]{2}[a-z][0-9]{2}[0-9a-z][a-z]$/i

A temporary solution I am using is:
^[a-z]{6}[0-9]{2}[a-z][0-9]{2}[a-z][0-9a-z]{3}[a-z]$/i

I think that all the indexes where we can find a char replaced with an omocodia code sould be replaced
in the regexp from [0-9] to [0-9a-z].

Like: ^[a-z]{6}[0-9a-z]{2}[a-z][0-9a-z]{2}[a-z][0-9a-z]{3}[a-z]$/i

Problema con CompositeCitiesList

Salve. Sto provando ad utilizzare CompositeCitiesList. In config\codicefiscale.php ho configurato in questo modo:

'city-decoder' => '\robertogallea\LaravelCodiceFiscale\CityCodeDecoders\CompositeCitiesList',

'cities-decoder-list' => [
    '\robertogallea\LaravelCodiceFiscale\CityCodeDecoders\ISTATRemoteCSVList',
    '\robertogallea\LaravelCodiceFiscale\CityCodeDecoders\InternationalCitiesStaticList',
],

Poi in src\CodiceFiscale.php ho inserito use robertogallea\LaravelCodiceFiscale\CityCodeDecoders\CompositeCitiesList; e nel costruttore ho sostituito questo:

$this->cityDecoder = isset($cityDecoder) ? $cityDecoder : new InternationalCitiesStaticList();

con questo:

`$this->cityDecoder = isset($cityDecoder) ? $cityDecoder : new CompositeCitiesList();`

Quindi nel controller ho:

use robertogallea\LaravelCodiceFiscale\CodiceFiscale;
use robertogallea\LaravelCodiceFiscale\CityCodeDecoders\CompositeCitiesList;

$cf = new CodiceFiscale(new CompositeCitiesList());
$result = $cf->parse('UnCodiceFiscaleCorretto');
print_r($cf->getError());
print_r($result);

E mi viene restituita pagina bianca... Dove sbaglio?

Bug

Ciao Roberto, credo di aver trovato un bug nel tuo pacchetto. Alla riga 92 della classe CodiceFiscale istanzi il codice fiscale perdendo il "city-decoder" custom.

install failed

Installation fails on laravel 6.x. This is the log:

composer require robertogallea/laravel-codicefiscale Using version ^1.2 for robertogallea/laravel-codicefiscale
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals

  • Installing robertogallea/laravel-codicefiscale (1.2.1): Downloading (100%)
    Writing lock file
    Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi

Symfony\Component\Debug\Exception\FatalThrowableError : Class name must be a valid object or a string

at \build\vendor\robertogallea\laravel-codicefiscale\src\CodiceFiscaleServiceProvider.php:33
29| public function register()
30| {
31| $this->app->singleton(CodiceFiscale::class, function (Container $app) {
32| return new CodiceFiscale(

33| new $app['config']'codicefiscale.city-decoder'
34| );
35| });
36| }
37|

Exception trace:

1 robertogallea\LaravelCodiceFiscale\CodiceFiscaleServiceProvider::robertogallea\LaravelCodiceFiscale{closure}(Object(Illuminate\Foundation\Application), [])
\build\vendor\laravel\framework\src\Illuminate\Container\Container.php:800

2 Illuminate\Container\Container::build(Object(Closure))
\build\vendor\laravel\framework\src\Illuminate\Container\Container.php:682

Please use the argument -v to see more details.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Installation failed, reverting ./composer.json to its original content.

Impossible to use MyCitiesList class when generate a codice fiscale

Hi Roberto, thanks for your great job!
I noticed that when I generate a codice fiscale, it always use the ItalianCitiesStaticList, instead of InternationalCitiesStaticList (used as default in CodiceFiscale constructor), or in my case, my own class.
is it possible to fix this?

ISTAT bloccato

Segnalo un blocco del sito dell'istat per il check CF a causa di rischio attacchi informatici.

Schermata 2021-12-14 alle 11 34 46

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.