Laravel Ecuador Identification is a validation library for Laravel, which allows the validation of personal and business identification documents, according to the country's tax regulations.
It is fully adaptable to Laravel's Facade and Validator Class. Its use is also shown in a Facade identified with the name of the country. You can use it as follows.
$request->validate([
'identification' => 'ecuador:natural_ruc',
]);
Or with Validator Facade
$validator = Validator::make($request->all(), [
'identification' => 'ecuador:natural_ruc',
]);
Or with Ecuador Facade
use Luilliarcec\LaravelEcuadorIdentification\Facades\EcuadorIdentification;
EcuadorIdentification::validateNaturalRuc('1710034065001'); // Return null or string code
You can install the package via composer:
composer require luilliarcec/laravel-ecuador-identification
When using the Laravel validator, each of them can be accessed by simply calling the validations by placing the [rule_name]:[validation_name].
For ecuador use the "ecuador" rule
Ecuador has 5 types of documents, identification person or identity card, ruc of natural persons, ruc of private companies and ruc of public companies, in addition to billing the fictitious document of final consumer is used.
Validation rules:
- Final Customer
- Personal Identification
- Natural Ruc
- Private Ruc
- Public Ruc
- Ruc
- Is Juridical Person
- Is Natural Person
- All Identifications
Validate the final consumer document, this validation on the Facade returns your billing code
Validate the Ecuadorian identification card, this validation on the Facade returns your billing code
Validates the Ecuadorian RUC of Natural Person, this validation on the Facade returns your billing code
Validates the Ecuadorian RUC of Private Companies, this validation on the Facade returns your billing code
Validates the Ecuadorian RUC of Public Companies, this validation on the Facade returns your billing code
Validates the Ecuadorian RUC Companies (Public, Natural and Private), this validation on the Facade returns your billing code
The group called juridical persons are those that have an private ruc or a public ruc such validation on the Facade will return the billing code if the person has one of these documents, otherwise null.
The group called natural persons are those that have an Ecuadorian identity card or a natural ruc such validation on the Facade will return the billing code if the person has one of these documents, otherwise null.
Validate the number with all types of documents. It includes the validation of final consumer. This validation in the Facade returns the corresponding billing code, if it fails, it returns null.
Validations return true or false following the laravel validation convention.
$request->validate([
'identification' => 'ecuador:personal_identification',
]);
Facades return null if the document number does not match any type, otherwise they return the billing code.
use Luilliarcec\LaravelEcuadorIdentification\Facades\EcuadorIdentification;
EcuadorIdentification::validateAllTypeIdentification('9999999999999'); // Return '07' => Final Consumer
If you like to use the translation system of Laravel to present the messages or attributes. Access the corresponding
files located in the resources\lang\{language_code}\validation
folder.
resources\lang\en\validation:
return [
...
'ecuador' => 'The :attribute field does not have the corresponding country format. (Ecuador)',
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [
'id' => 'Ecuadorian Identification',
],
];
resources\lang\es\validation:
return [
...
'ecuador' => 'El campo :attribute no tiene el formato de país correspondiente. (Ecuador)',
/*
|--------------------------------------------------------------------------
| Custom Validation Attributes
|--------------------------------------------------------------------------
|
| The following language lines are used to swap our attribute placeholder
| with something more reader friendly such as "E-Mail Address" instead
| of "email". This simply helps us make our message more expressive.
|
*/
'attributes' => [
'id' => 'Identificación Ecuatoriana',
],
];
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the Laravel Package Boilerplate.