-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creación de README para instrucciones de uso. Workflow para ejecutar …
…test
- Loading branch information
Showing
5 changed files
with
112 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Laravel Validate Test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
laravel-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e | ||
with: | ||
php-version: '8.3' | ||
- uses: actions/checkout@v3 | ||
- name: Copy .env | ||
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | ||
- name: Install Dependencies | ||
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist | ||
- name: Generate key | ||
run: php artisan key:generate | ||
- name: Directory Permissions | ||
run: chmod -R 777 storage bootstrap/cache | ||
- name: Execute tests (Unit and Feature tests) via PHPUnit | ||
run: vendor/bin/phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# laravel-validate-ec | ||
[![Latest Stable Version](http://poser.pugx.org/tonystore/laravel-validate-ec/v)](https://packagist.org/packages/tonystore/laravel-validate-ec) [![Total Downloads](http://poser.pugx.org/tonystore/laravel-validate-ec/downloads)](https://packagist.org/packages/tonystore/laravel-validate-ec) [![Latest Unstable Version](http://poser.pugx.org/tonystore/laravel-validate-ec/v/unstable)](https://packagist.org/packages/tonystore/laravel-validate-ec) [![License](http://poser.pugx.org/tonystore/laravel-validate-ec/license)](https://packagist.org/packages/tonystore/laravel-validate-ec) [![PHP Version Require](http://poser.pugx.org/tonystore/laravel-validate-ec/require/php)](https://packagist.org/packages/tonystore/laravel-validate-ec) | ||
|
||
Librería para validar la estructura de los diferentes tipos de documentos de identificación emitidos para ecuador. | ||
|
||
Para realizar las validaciones, se usa la librería [tavo1987/ec-validador-cedula-ruc](https://github.com/tavo1987/ec-validador-cedula-ruc) desarrollada por [tavo1987](https://github.com/tavo1987) para PHP | ||
|
||
|
||
Se podrá validar los números de identificación de los siguientes tipos: | ||
* Cédula | ||
|
||
## Requerimientos | ||
|
||
- [PHP >= ^7.4](http://php.net) | ||
- [Laravel 5| 6 | 7 | 8 | 9 | 10 | 11](https://laravel.com) | ||
|
||
|
||
## Instalación via composer | ||
|
||
Ejecuta este comando en la consola | ||
``` bash | ||
composer require tonystore/laravel-validate-ec | ||
``` | ||
## Publicar archivos de traducciones | ||
Por defecto, la librería contiene su mensaje de traducción para es y en, usted puede sobreescribir este mensaje de la siguiente manera | ||
|
||
```sh | ||
php artisan vendor:publish --provider="Tonystore\LaravelValidateEc\LaravelValidateEcProvider" --tag="validate-lang-es" // Validación en español | ||
php artisan vendor:publish --provider="Tonystore\LaravelValidateEc\LaravelValidateEcProvider" --tag="validate-lang-en" // Validación en ingles | ||
``` | ||
|
||
## Casos de uso | ||
### Ejemplo 1 | ||
Uso mediante las validaciones de laravel | ||
```php | ||
<?php | ||
|
||
$validatedData = $request->validate([ | ||
'cedula' => ['required', 'document_ec:ci'], | ||
]); | ||
|
||
``` | ||
|
||
### Ejemplo 2 | ||
Uso mediante una Regla de validación | ||
```php | ||
<?php | ||
|
||
use Tonystore\LaravelValidateEc\Rules\ValidDocumentEc; | ||
|
||
$validatedData = $request->validate([ | ||
'cedula' => ['required', new ValidDocumentEc('ci')], | ||
]); | ||
|
||
``` | ||
|
||
## Autor | ||
|
||
Esta librería fue desarrollada y es mantenido por [Anthony Medina](https://github.com/tony98ms) | ||
|
||
Si deseas contribuir con este proyecto o encuentras algún error, puedes crear un issue o un pull request, para esto deberá pasar todos los tests | ||
|
||
## Licencia | ||
|
||
Licencia de tipo [MIT License](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,23 @@ | |
"name": "tonystore/laravel-validate-ec", | ||
"description": "Libreria para validar la estructura de los diferentes tipos de documentos de identificación emitidos para ecuador", | ||
"type": "library", | ||
"keywords": ["laravel", "ecuador", "validador", "cedula", "ruc"], | ||
"keywords": [ | ||
"laravel", | ||
"ecuador", | ||
"validador", | ||
"cedula", | ||
"ruc" | ||
], | ||
"require": { | ||
"php": "^7.4 || ^8.0", | ||
"php": "^7.4|^8.0", | ||
"tavo1987/ec-validador-cedula-ruc": "^1.0", | ||
"illuminate/validation": "^9.0 || ^10.0 || ^11.0", | ||
"illuminate/support": "^9.0 || ^10.0 || ^11.0" | ||
"illuminate/support": "~5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", | ||
"illuminate/validation": "~5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0" | ||
}, | ||
"require-dev": { | ||
"orchestra/testbench": "^8.0", | ||
"phpunit/phpunit": "^9.0 || ^10.0 || ^11.0", | ||
"nunomaduro/collision": "^7.8" | ||
"phpunit/phpunit": "~5.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0", | ||
"nunomaduro/collision": "~5.0|^6.0|^7.0|^8.0" | ||
}, | ||
"license": "MIT", | ||
"autoload": { | ||
|
@@ -25,12 +31,14 @@ | |
"Tonystore\\LaravelValidateEc\\Tests\\": "tests/" | ||
} | ||
}, | ||
"authors": [{ | ||
"name": "Anthony Medina Sandoval", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/tony98ms", | ||
"role": "Developer" | ||
}], | ||
"authors": [ | ||
{ | ||
"name": "Anthony Medina Sandoval", | ||
"email": "[email protected]", | ||
"homepage": "https://github.com/tony98ms", | ||
"role": "Developer" | ||
} | ||
], | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
|
@@ -39,4 +47,4 @@ | |
} | ||
}, | ||
"minimum-stability": "dev" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters