Download the PHP package simsoft/validator without Composer
On this page you can find all versions of the php package simsoft/validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download simsoft/validator
More information about simsoft/validator
Files in simsoft/validator
Package validator
Short Description A Laravel-inspired validation wrapper for Symfony Validator with custom rules, error handling, and validated input support.
License MIT
Homepage https://github.com/simsoft/validator
Informations about the package validator
Simsoft Validator
A Laravel-inspired validation wrapper for Symfony Validator. Simple API, full power of Symfony constraints.
Requirements
- PHP >= 8.4
- Symfony Validator ^8.1
A few specialised constraints (Country, Currency, Language, Bic,
Video) need an extra Symfony component —
see Optional Dependencies.
Installation
Basic Usage
Rule::bail() vs array rules:
Rule::bail([...])— stops at the first failing constraint (short-circuit)[...](plain array) — runs all constraints and collects all violations
Retrieving Validated Data
Handling Errors
Custom Validator Class
One Validator per Validation
A validator remembers what it last validated — the input, the validated data,
and the errors. Create a new one each time, which is what Validator::make()
already does. Do not register a validator as a container singleton, hold one in
a static property, or keep one alive across requests in a long-running runtime
(Swoole, RoadRunner, FrankenPHP): two requests sharing an instance would see
each other's data.
See One Validator per Validation.
Documentation
- Getting Started
- Constraints Reference
- Custom Rules with Closures
- Reusable Custom Constraints
- Validation Groups
- Nested & Wildcard Array Validation
- Conditional & Optional Rules
- After Hooks & Cross-Field Validation
- Runtime Rules & Configuration
- Comparison with Other Validators
- Why Object-Based Rules?
Available Constraints
All Symfony validation constraints are supported. See the Constraints Reference for copy-paste examples of the common ones, or Symfony Validation Constraints for the complete catalog.
License
MIT License. See LICENSE for details.
All versions of validator with dependencies
symfony/validator Version ^8.1
symfony/translation-contracts Version ^3.5