PHP code example of pollin14 / laravel-curp-validation

1. Go to this page and download the library: Download pollin14/laravel-curp-validation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pollin14 / laravel-curp-validation example snippets




use Illuminate\Contracts\Validation\Factory;
use Pollin14\LaravelCurpValidation\Rules\CurpRule;

$validator = app(Factory::class)->make(
            ['curp' => 'ABCD123456HABCDEF01'],
            ['curp' => ['

 

use Illuminate\Contracts\Validation\Factory;
use Pollin14\LaravelCurpValidation\Rules\CurpBirthdate;
use Pollin14\LaravelCurpValidation\Rules\CurpGender;
use Pollin14\LaravelCurpValidation\Rules\CurpLastConsonants;
use Pollin14\LaravelCurpValidation\Rules\CurpLastDigit;
use Pollin14\LaravelCurpValidation\Rules\CurpLength;
use Pollin14\LaravelCurpValidation\Rules\CurpPenultimateChar;
use Pollin14\LaravelCurpValidation\Rules\CurpStartWithFourLetters;
use Pollin14\LaravelCurpValidation\Rules\CurpState;

$rules = [
    'curp_length',
    'curp_date',
    'curp_gender',
    'curp_start_with_4_letters',
    'curp_last_digit',
    'curp_penultimate_char',
    'curp_state',
    'curp_birthdate'
];

// Or if you are using Lumen
$rules = [
    new CurpLength(),
    new CurpGender(),
    new CurpStartWithFourLetters(),
    new CurpLastDigit(),
    new CurpPenultimateChar(),
    new CurpState(),
    new CurpBirthdate(),
    new CurpLastConsonants(),
] 

$validator = app(Factory::class)->make(
            ['curp' => 'ABCD123456HABCDEF01'],
            ['curp' => $rules]
        );