PHP code example of ryodevz / validator

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

    

ryodevz / validator example snippets




use Ryodevz\Validator\Facades\Validator;

// Make validation
$validator = Validator::make([
    'name'  => $_POST['name'],
    'email' => $_POST['email'],
], [
    'name'  => ' key
$validator->errors();

// All error messages without key
$validator->all();

// First error message
$validator->first();



return [
    'array' => 'The :attribute must be an array.',
    'active_url' => 'The :attribute is not a valid URL.',
    'boolean' => 'The :attribute field must be true or false.',
    'confirmed' => 'The :attribute confirmation does not match.',
    'in' => 'The selected :attribute is invalid.',
    'ip' => 'The :attribute must be a valid IP address.',
    'ip4' => 'The :attribute must be a valid IPv4 address.',
    'ip6' => 'The :attribute must be a valid IPv6 address.',
    'integer' => 'The :attribute must be an integer.',
    'max' => [
        'integer' => 'The :attribute must not be greater than :max.',
        'string' => 'The :attribute must not be greater than :max characters.',
        'array' => 'The :attribute must not have more than :max items.',
    ],
    'min' => [
        'integer' => 'The :attribute must be at least :min.',
        'string' => 'The :attribute must be at least :min characters.',
        'array' => 'The :attribute must have at least :min items.',
    ],
    'not_in' => 'The selected :attribute is invalid.',
    '