Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 815 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 815 Bytes

marko/validation

Input validation with built-in rules, string-based rule parsing, and custom rule support — validate data before it reaches your domain.

Installation

composer require marko/validation

Quick Example

use Marko\Validation\Contracts\ValidatorInterface;

$errors = $this->validator->validate([...$request->input(), ...$request->files()], [
    'name' => 'required|string|max:100',
    'email' => 'required|email',
    'age' => 'nullable|integer|min:18',
    'avatar' => 'nullable|file|image|max_size:2048',
    'photos.*' => 'image|max_size:2048', // every file of a photos[] upload
]);

if ($errors->isNotEmpty()) {
    // handle errors
}

Documentation

Full usage, API reference, and examples: marko/validation