1. Go to this page and download the library: Download ideaglory/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/ */
ideaglory / validation example snippets
$data = [
'name' => 'John_Doe',
'emails' => ['email' => '[email protected]', 'email_confirm' => '[email protected]'],
'age' => 25,
'active' => true,
'website' => 'https://ideaglory.com',
'birthdate' => '1999-12-31',
'category' => 'technology',
'status' => 'inactive',
'first_name' => 'John',
'last_name' => 'Doe',
];
$validate = new Validation($data);
$validate->setDefaults([
'age' => 30,
'status' => 'active'
]);
$validate->setRules([
'name' => ', max 20 chars
]);
$validate->setMessages([
'name.e at least 18.',
'age.max' => 'The age must not exceed 60.',
'active.name is mandatory.',
'first_name.alpha' => 'The first name must contain only alphabetic characters.',
'last_name.