respect/validation
The most awesome validation engine ever created for PHP
3.1.2
41M downloads/mo
#724 most downloaded on Packagist
Respect/Validation
What this package is like to depend on
Last release 1 months ago
22 Jul 2026
Release timing varies
gaps range from 9 days to 7 months
Rarely documented
notes for 6 of 154 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
155 releases · first in 2012
15 releases in the last 12 months
see the full history below
Release timeline
155 releases · Apr 2012 to Jul 2026Releases
latest 60 of 155-
3.1.202 Jun 2026Release notes
Open source →What's Changed
- Fix: anchor MasterCard credit-card pattern by @nikkoenggaliano in #1774
- Bump dependencies
- Update Regional Information
Full Changelog: 3.1.1...3.1.2
-
3.1.119 Mar 2026Release notes
Open source →What's Changed
- Fix isVisible() initial value bug in NestedListStringFormatter by @alganet in #1717
- Fix deep path chain and root template cascading bugs by @alganet in #1723
- Bump dependencies
- Update Regional Information
Full Changelog: 3.1.0...3.1.1
-
3.1.002 Mar 2026Release notes
Open source → -
3.0.226 Feb 2026Release notes
Open source →What's Changed
- Change isValid method to public + Change validator registration by @mc7244 in #1693
- Bump phpstan/phpstan-phpunit from 2.0.13 to 2.0.14 by @dependabot[bot] in #1694
- Bump phpstan/phpstan-phpunit from 2.0.14 to 2.0.16 by @dependabot[bot] in #1697
- Bump phpstan/phpstan-deprecation-rules from 2.0.3 to 2.0.4 by @dependabot[bot] in #1699
- Bump pestphp/pest from 4.3.2 to 4.4.1 by @dependabot[bot] in #1698
- Bump symfony/console from 7.4.4 to 8.0.4 by @dependabot[bot] in #1704
- Bump phpstan/phpstan from 2.1.39 to 2.1.40 by @dependabot[bot] in #1705
- Bump giggsey/libphonenumber-for-php-lite from 9.0.23 to 9.0.24 by @dependabot[bot] in #1706
- Update Regional Information by @github-actions[bot] in #1707
New Contributors
Full Changelog: 3.0.1...3.0.2
-
3.0.110 Feb 2026Nothing published for this version
-
3.0.009 Feb 2026Release notes
Open source →Respect\Validation 3.0
Respect\Validation 3.0 is a major release with breaking changes, improved performance, and new features for more flexible validation. This version requires PHP 8.5+ (up from 8.1+ in 2.x). Update via:
composer require respect/validation:^3.0
For detailed migration instructions, see the Migration Guide.
Breaking Changes
- Class and Namespace Renames:
Validatorrenamed toValidatorBuilderRulesnamespace toValidatorsRuleinterface toValidatorFactorytoValidatorFactoryInvalidRuleConstructorExceptiontoInvalidValidatorException.
- Validation Methods:
validate()now returns aResultQueryobject instead of a boolean (useisValid()for boolean checks)check()andassert()now throw a unifiedValidationException(validator-specific exceptions removed;NestedValidationExceptionremoved).
- Removed Validators:
Type(use specific type validators likestringType())Yes/No(usetrueVal()/falseVal())KeyNested(use nestedkey())Age/MinAge/MaxAge(usedateTimeDiff())PrimeNumber/Fibonacci/PerfectSquare/FilterVar/Uploaded(usesatisfies())VideoUrl(no direct replacement).
- Behavior Changes:
Attributereplaced byProperty/PropertyOptional/PropertyExistsKeysplit intoKey/KeyOptional/KeyExistsLengthandSizesignatures changed to use composition (e.g.,length(v::between(5, 10)))Eachstricter (rejects non-iterables likestdClass)- Composite validators (
AllOf, etc.) require at least two validators After(ex-Call) no longer handles callback errorsContains/ContainsAny/In/EndsWith/StartsWithnow strict by defaultUrlvalidates domains/IPs, dropsnewsscheme, addsEmailformailto- New dependencies for some validators (
sokil/php-isocodes,ramsey/uuid).
- Renamed Validators:
CalltoAfterCallbacktoSatisfiesMintoGreaterThanOrEqualMaxtoLessThanOrEqualNullabletoNullOrOptionaltoUndefOrKeyValuetoFactoryNotBlankinverted toBlank(usenot(v::blank()))NotEmptyinverted/renamed toFalsy(usenot(v::falsy()))NoWhitespaceinverted/renamed toSpaced(usenot(v::spaced()))IterableTypetoIterableVal(stricterIterableTypenow exists separately).
- Custom Messages:
setTemplate()andsetName()removed (usetemplated()andnamed()){{name}}placeholder renamed to{{subject}}.
- Factory/Container:
Factoryreplaced by PSR-11 container viaContainerRegistry. - Custom Validators: No longer need separate exception classes
- use
#[Template]attributes on validator classes.
- use
New Features
-
Result-Based Validation:
validate()returns aResultQueryfor detailed error inspection.$result = v::numericVal()->positive()->between(1, 255)->validate($input); $result->hasFailed(); // bool $result->getFullMessage(); // All errors as tree
-
Attribute Validation: Validate object properties via PHP attributes.
class User { #[Validators\Email] public string $email; #[Validators\Between(18, 120)] public int $age; } v::attributes()->assert($user); // Validates all annotated properties
-
ShortCircuit Validation: Stops at first failure for dependent checks.
v::shortCircuit( v::key('countryCode', v::countryCode()), v::factory(fn($input) => v::key('subdivisionCode', v::subdivisionCode($input['countryCode']))) )->assert(['countryCode' => 'US', 'subdivisionCode' => 'CA']); // Passes
-
Dynamic Factory Validators: Create validators based on input.
v::factory(fn($input) => v::key('confirmation', v::equals($input['password'] ?? null))) ->assert(['password' => 'secret', 'confirmation' => 'secret']); // Passes
-
Prefixed Shortcuts: Convenient wrappers for common patterns.
v::nullOrEmail()->assert(null); // Passes v::allPositive()->assert([1, 2, 3]); // Passes v::notBlank()->assert('hello'); // Passes
-
Result Composition: Nested results for clearer messages (e.g.,
all(v::intType())→ "Every item must be an integer"). -
Paths in Errors: Full dot-notation paths for nested failures (e.g.,
.mysql.host must be a string). -
Helpful Stack Traces: Traces point to user code, not library internals.
-
Custom Exceptions: Pass exceptions to
assert().v::email()->assert($input, new DomainException('Invalid email'));
-
Placeholder Pipes: Customize template rendering (e.g.,
{{haystack|list:or}}→ "active" or "pending"). -
Symfony Translation: Uses Symfony contracts for message translation.
-
New Validators:
All,BetweenExclusive,ContainsCount,DateTimeDiff,Formatted,Hetu,KeyExists,KeyOptional,Named,PropertyExists,PropertyOptional,Templated.
For more details, see the Feature Guide, Validators List, or open an issue on GitHub.
- Class and Namespace Renames:
-
2.5.022 Jul 2026 -
2.4.1208 Feb 2026Nothing published for this version
-
2.4.1107 Feb 2026Nothing published for this version
-
2.4.1014 Jan 2026Nothing published for this version
-
2.4.909 Jan 2026Nothing published for this version
-
2.4.806 Jan 2026Nothing published for this version
-
2.4.704 Jan 2026Nothing published for this version
-
2.4.604 Jan 2026Nothing published for this version
-
2.4.530 Dec 2025Nothing published for this version
-
2.4.407 Jun 2025Nothing published for this version
-
2.4.314 May 2025Nothing published for this version
-
2.4.212 May 2025Nothing published for this version
-
2.4.111 Jan 2025Nothing published for this version
-
2.4.007 Jan 2025Nothing published for this version
-
2.3.1306 Jan 2025Nothing published for this version
-
2.3.1206 Jan 2025Nothing published for this version
-
2.3.1113 Dec 2024Nothing published for this version
-
2.3.1005 Dec 2024Nothing published for this version
-
2.3.928 Nov 2024Nothing published for this version
-
2.3.826 Nov 2024Nothing published for this version
-
2.3.713 Apr 2024Nothing published for this version
-
2.3.624 Mar 2024Nothing published for this version
-
2.3.515 Mar 2024Nothing published for this version
-
2.3.411 Mar 2024Nothing published for this version
-
2.3.311 Mar 2024Nothing published for this version
-
2.3.202 Feb 2024Nothing published for this version
-
2.3.128 Jan 2024Nothing published for this version
-
2.3.027 Jan 2024Nothing published for this version
-
2.3.0-RC20 Feb 2023 pre-releaseNothing published for this version
-
2.2.415 Feb 2023Nothing published for this version
-
2.2.319 Mar 2021Nothing published for this version
-
2.2.214 Mar 2021Nothing published for this version
-
2.2.106 Feb 2021Nothing published for this version
-
2.2.006 Feb 2021Nothing published for this version
-
2.1.004 Oct 2020Nothing published for this version
-
2.0.1723 Aug 2020Nothing published for this version
-
2.0.1625 Jul 2020Nothing published for this version
-
2.0.1521 Jul 2020Nothing published for this version
-
2.0.1421 Jul 2020Nothing published for this version
-
2.0.1319 Jul 2020Nothing published for this version
-
2.0.1214 Jul 2020Nothing published for this version
-
2.0.1112 Jul 2020Nothing published for this version
-
2.0.1007 Jun 2020Nothing published for this version
-
2.0.903 Jun 2020Nothing published for this version
-
2.0.820 May 2020Nothing published for this version
-
2.0.719 May 2020Nothing published for this version
-
2.0.618 May 2020Nothing published for this version
-
2.0.518 May 2020Nothing published for this version
-
2.0.418 May 2020Nothing published for this version
-
2.0.313 May 2020Nothing published for this version
-
2.0.108 Apr 2020Nothing published for this version
-
2.0.004 Apr 2020Nothing published for this version
-
1.1.3128 May 2019Nothing published for this version
-
1.1.3031 Mar 2019Nothing published for this version