Download the PHP package robertogallea/laravel-codicefiscale without Composer

On this page you can find all versions of the php package robertogallea/laravel-codicefiscale. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-codicefiscale

Laravel Codice Fiscale

laravel-codicefiscale

Author Latest Version on Packagist Laravel >=6.0 Sponsor me! Packagist Downloads

laravel-codicefiscale is a package for the management of the Italian CodiceFiscale (i.e. tax code). The package allows easy validation and parsing of the CodiceFiscale. It is also suited for Laravel since it provides a convenient custom validator for request validation.

Important update: now you can dynamically load city codes from ISTAT using the non-default IstatRemoteCSVList city decoder.

Installation

Run the following command to install the latest applicable version of the package:

Laravel

In your app config, add the Service Provider to the $providers array (only for Laravel 5.4 or below):

The validation error messages are translated in it and en languages, if you want to add new language please send me a PR.

Lumen

In bootstrap/app.php, register the Service Provider

Configuration

To customize the package configuration, you must export the configuration file into config/codicefiscale.php.

This can be achieved by launching the following command:

You can configure the following parameters:

Language Files

You can customize the validation messages publishing the validation translations with this command:

Validation

To validate a codice fiscale, use the codice_fiscale keyword in your validation rules array

From version 1.9.0 you can validate your codice fiscale against other form fields to check whether there is a match or not.

You must specify all of the required fields:

giving parameters to the codice_fiscale rule.

For example:

Validation fails if the provided codicefiscale and the one generated from the input fields do not match.

Utility CodiceFiscale class

A codice fiscale can be wrapped in the robertogallea\LaravelCodiceFiscale\CodiceFiscale class to enhance it with useful utility methods.

In case of a valid codicefiscale it produces the following result:

in case of an error, CodiceFiscale::parse() throws an CodiceFiscaleValidationException, which returns one of the defined constants with $exception->getCode():

If you rather not want to catch exceptions, you can use CodiceFiscale::tryParse():

which returns the same values as above, you can use $cf->isValid() to check if the codicefiscale is valid and $cf->getError() to get the error. This is especially useful in a blade template:

Codice fiscale Generation

Class CodiceFiscale could be used to generate codice fiscale strings from input values:

City code parsing

There are three strategies for decoding the city code:

By default, the package uses the class InternationalCitiesStaticList to lookup the city from the code and viceversa. However you could use your own class to change the strategy used.

You just need to implement the CityDecoderInterface and its getList() method. Then, to use it, just pass an istance to the CodiceFiscale class.

For example:

Integrate your own cities

Note: if you find missing cities, please make a PR!

If you want to integrate the cities list, you can use the CompositeCitiesList by merging the results of one of the decoders provided and a custom decoder.

For example:

where MyCustomList is defined as:


All versions of laravel-codicefiscale with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
illuminate/support Version >=6.0
illuminate/validation Version >=6.0
nesbot/carbon Version ^2.16
guzzlehttp/guzzle Version ^7.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package robertogallea/laravel-codicefiscale contains the following files

Loading the files please wait ....