webCOMAND

validate::__construct()

Prepare to validate HTTP GET and POST values.

Prototype

validate __construct(array $options = [])

Parameters

  • options - Associative array where the key/value pairs are:
    • request - A request object to use to retrieve values.  If not provided, a new request object will be created and used automatically.

Example

$request = new \io_comand_web\request();
$validate = new \io_comand_web\validate([
    'request' => $request
]);
$validate->request('email',
    ['trim', 'required', 'email'],
    'Invalid email address'
);
if($validate->valid()) {
    echo('Email is valid.');
}