- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.php
More file actions
Latest commit
19 lines (15 loc) · 438 Bytes
/
Copy pathbasic.php
File metadata and controls
19 lines (15 loc) · 438 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
require__DIR__ . '/../vendor/autoload.php';
useGravity\DataVerify;
$data = newstdClass();
$data->email = $_POST['email'] ?? 'test@example.com';
$data->age = $_POST['age'] ?? 25;
$verifier = newDataVerify($data);
$verifier
->field('email')->required->email
->field('age')->required->int->between(18, 100);
if ($verifier->verify()) {
echo"✓ Validation passed!\n";
} else {
print_r($verifier->getErrors());
}