Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/luilliarcec/laravel-ecuador-identification
Validations for Laravel for identifications of people and companies of Ecuador, an important requirement for electronic invoicing.
https://github.com/luilliarcec/laravel-ecuador-identification
ecuador identification-person laravel-ecuador-identification php8 rule-ruc sri
Last synced: 2 months ago
JSON representation
Validations for Laravel for identifications of people and companies of Ecuador, an important requirement for electronic invoicing.
- Host: GitHub
- URL: https://github.com/luilliarcec/laravel-ecuador-identification
- Owner: luilliarcec
- License: mit
- Created: 2020-02-04T02:17:11.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-07-24T13:36:47.000Z (over 1 year ago)
- Last Synced: 2024-10-08T01:17:37.243Z (3 months ago)
- Topics: ecuador, identification-person, laravel-ecuador-identification, php8, rule-ruc, sri
- Language: PHP
- Homepage:
- Size: 67.4 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Laravel Ecuador Identification
![Run Tests](https://github.com/luilliarcec/laravel-ecuador-identification/workflows/Run%20Tests/badge.svg?branch=master)
[![Latest Version on Packagist](https://img.shields.io/packagist/v/luilliarcec/laravel-ecuador-identification.svg)](https://packagist.org/packages/luilliarcec/laravel-ecuador-identification)
[![Quality Score](https://img.shields.io/scrutinizer/g/luilliarcec/laravel-ecuador-identification)](https://scrutinizer-ci.com/g/luilliarcec/laravel-ecuador-identification)
[![Total Downloads](https://img.shields.io/packagist/dt/luilliarcec/laravel-ecuador-identification)](https://packagist.org/packages/luilliarcec/laravel-ecuador-identification)
[![GitHub license](https://img.shields.io/github/license/luilliarcec/laravel-ecuador-identification.svg)](https://github.com/luilliarcec/laravel-ecuador-identification/blob/master/LICENSE.md)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.
```php
$request->validate([
'identification' => 'ecuador:natural_ruc',
]);
```Or with Validator Facade
```php
$validator = Validator::make($request->all(), [
'identification' => 'ecuador:natural_ruc',
]);
```Or with Ecuador Facade
```php
use Luilliarcec\LaravelEcuadorIdentification\Facades\EcuadorIdentification;EcuadorIdentification::validateNaturalRuc('1710034065001'); // Return null or string code
```## Installation
You can install the package via composer:
```bash
composer require luilliarcec/laravel-ecuador-identification
```## Usage
When using the Laravel validator, each of them can be accessed by simply calling the validations by placing the [rule_name]:[validation_name].
### Ecuador (ecuador)
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](#rule-final_customer)
* [Personal Identification](#rule-personal_identification)
* [Natural Ruc](#rule-natural_ruc)
* [Private Ruc](#rule-private_ruc)
* [Public Ruc](#rule-public_ruc)
* [Ruc](#rule-ruc)
* [Is Juridical Person](#rule-is_juridical_person)
* [Is Natural Person](#rule-is_natural_person)
* [All Identifications](#rule-all_identifications)
#### final_customer
Validate the final consumer document, this validation on the Facade returns your billing code
#### personal_identification
Validate the Ecuadorian identification card, this validation on the Facade returns your billing code
#### natural_ruc
Validates the Ecuadorian RUC of Natural Person, this validation on the Facade returns your billing code
#### private_ruc
Validates the Ecuadorian RUC of Private Companies, this validation on the Facade returns your billing code
#### public_ruc
Validates the Ecuadorian RUC of Public Companies, this validation on the Facade returns your billing code
#### ruc
Validates the Ecuadorian RUC Companies (Public, Natural and Private), this validation on the Facade returns your billing code
#### is_juridical_person
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.
#### is_natural_person
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.
#### all_identifications
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.### Example
#### ValidatorValidations return true or false following the laravel validation convention.
```php
$request->validate([
'identification' => 'ecuador:personal_identification',
]);
```#### Facade
Facades return null if the document number does not match any type, otherwise they return the billing code.
```php
use Luilliarcec\LaravelEcuadorIdentification\Facades\EcuadorIdentification;EcuadorIdentification::validateAllTypeIdentification('9999999999999'); // Return '07' => Final Consumer
```## Translations
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.##### Example
``resources\lang\en\validation:``
```php
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:``
```php
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',
],
];
```### Testing
``` bash
composer test
```### Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
### Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
## Credits
- [Luis Andrés Arce C.](https://github.com/luilliarcec)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
## Laravel Package Boilerplate
This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).