PHP code example of jhonymiler / validation

1. Go to this page and download the library: Download jhonymiler/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/ */

    

jhonymiler / validation example snippets


$validator = new Validator('pt_BR');

[
    'returnStatus' => 0,
    'message'      => 123456,
    'partyNumber'  => '123',
    'partyId'      => 300000001,
    'logdate'      => '2023-01-01T00:00:00.000',
]

[
    'returnStatus' => null,
    'message'      => 'asdfasdsadf',
    'partyNumber'  => 123,
    'partyId'      => '1231233',
    'logdate'      => '2023-01-01',
]

use JhonyMiler\Validation

   'returnStatus' => 0,
        'message'      => 123456,
        'partyNumber'  => '123',
        'partyId'      => 300000001,
        'logdate'      => '2023-01-01T00:00:00.000',
    ],
    [
        'returnStatus' => null,
        'message'      => 'asdfasdsadf',
        'partyNumber'  => 123,
        'partyId'      => '1231233',
        'logdate'      => '2023-01-01',
    ],
];

$rules = [
    'returnStatus' => ' {
    $response = [
        'message' => 'Erro de validação de dados.',
        'errors'  => $errors,
    ];

    echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
    exit;
}