PHP code example of rudra / validation

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

    

rudra / validation example snippets


use Rudra\Validation\ValidationFacade;

$_SESSION['csrf'][] = '123456';

$processed = [
    'set_without_validation' => ValidationFacade::set('set_without_validation')->run();
    'set_with_data_clearing' => ValidationFacade::sanitize(' <p>String</p> ')->run();
    
    '('12345')->equals('12345')->run();
    'email'    => ValidationFacade::email('[email protected]')->run();
    'csrf'     => ValidationFacade::set('123456')->csrf($_SESSION['csrf'])->run();
];

ValidationFacade::sanitize(' <p>12345</p> ')->max(25)->run();

if (ValidationFacade::approve($processed)) {
    $validated = ValidationFacade::getValidated($processed, ["csrf", "_method"]);
}

ValidationFacade::getAlerts($processed, ['