PHP code example of legatus / validator
1. Go to this page and download the library: Download legatus/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/ */
legatus / validator example snippets
$validator = Legatus\Http\Validator::build($psr7Request)
->body('id')->)
->body('name.last')->string()->efore('-18years')
->body('promo_code')->custom(new Legatus\Http\PromoCode()) // And instance of rule or a callable
->body('emails.*')->email()
->body('addresses.*.lineOne')-> {
// $data = $e->getData();
}
[$id, $name, $password, $birthDate, $promoCode, $emails, $addresses] = $data->values();