ReqShield: Fast PHP Validation and Sanitization#
ReqShield is a schema-based request validator and sanitizer for modern PHP apps. It supports nested/wildcard validation, localized/custom messages, batched database rules, sanitizer pipelines, typed output, and schema export.
Quick Start#
<?php
use Infocyph\ReqShield\Validator;
$validator = Validator::make([
'email' => 'required|email|max:255',
'age' => 'required|integer|min:18',
])->setSanitizers([
'email' => ['trim', 'lowercase'],
])->setCasts([
'age' => 'integer',
]);
$result = $validator->validate([
'email' => ' [email protected] ',
'age' => '21',
]);
if ($result->passes()) {
print_r($result->typed()); // ['email' => '[email protected]', 'age' => 21]
} else {
print_r($result->errors());
}
Table of Contents#
Getting Started
Core Features
Reference