Skip to content

Laravel Packages. Library to validate Uruguayan identity document.

License

Notifications You must be signed in to change notification settings

pfrug/validate-document-uy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ValidateUy

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.

About

Laravel Packages. Library to validate Uruguayan identity document.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages