pfrug / validate-document-uy
Library to validate Uruguayan identity document
v1.0
2023-03-20 22:43 UTC
Requires (Dev)
- orchestra/testbench: ^8.0
- phpunit/phpunit: ^10.0
- squizlabs/php_codesniffer: ^3.7
This package is not auto-updated.
Last update: 2024-05-15 02:18:34 UTC
README
Library to validate Uruguayan identity document
Installation
composer require pfrug/validate-document-uy
// config/app.php 'providers' => [ ... Pfrug\ValidateDocumentUy\ValidateCIServiceProvider::class, ];
And optionally register an alias for the facade.
// config/app.php 'aliases' => [ ... 'ValidateCI' => Pfrug\ValidateDocumentUy\Facades\ValidateCI::class, ];
Usage
ValidateCI::isValid('30780892'); // true ValidateCI::isValid('3.078.089-2'); // true ValidateCI::isValid('30780890'); // false ValidateCI::controlDigit('3078089'); // 2 ValidateCI::gerRandomDocument();
Validation
The package provides custom rules to validate a Uruguayan document
$validator = Validator::make($data, [ 'document1' => 'validate_ci', // Using shorthand notation 'document2' => new DocumentUyRule(), // Using custom rule class ]);
Configuration
Optionally you can Publish the language files for translations
php artisan vendor:publish --tag="validate-document-uy"
This command create file translations to: {project}resources/lang/vendor/validate-document-uy/{en-es}/validation.php
License
The MIT License (MIT). Please see License File for more information.