1. Go to this page and download the library: Download bdbch/vivalidator 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/ */
bdbch / vivalidator example snippets
// Make sure to use the feature in your component
use Vivalidator\Validator;
// Data to validate. I left the job empty on purpose to demonstrate non-valid data
$data = [
'name' => 'Peter',
'age' => '23',
'job' => ''
];
// Validator Options / Rules
// Each field can have multiple rules with their own error messages
$options = [
'name' => [
[
'rule' => ' [
'rule' => 'max',
'value' => 150,
'error' => 'I would love to believe you, but I will not'
]
],
'job' => [
[
'rule' => 'h the submitted data
// Make sure to escape the data. The validator doesn't do this right now
// TODO: This will be a feature so fields can be escaped if needed
// Check this URL if you need a Key
// https://www.google.com/recaptcha/admin
// Make sure you have a working ReCaptcha library installed,
// otherwise this will do nothing
$validator = new Validator($data, $options, [
'recaptcha' => [
'secret' => 'YOUR_SECRET_KEY_HERE',
'error' => 'Please verify our captcha'
]
]);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.