-
Notifications
You must be signed in to change notification settings - Fork 1
FAQ
No. A failed validation is the normal false return of validation(), with the
messages available from getError(). Exceptions are reserved for programming and
configuration errors — see Exceptions.
The rule name is not a built-in rule or a rule registered with extend() —
usually a typo (integerr, requierd). Unknown rules fail loudly so a typo
never silently skips validation. See
Migration from 1.x.
validation() consumes the rule queue. Each run validates only the rules
queued since the last run. Queue rules again if you need them re-checked — see
The Validation Lifecycle.
getError() returns a flat list. Validate each field in its own run and key the
results, or use self-describing custom messages. See
Error Messages and the
Recipes.
optional only skips a field that is missing or null. An empty string
('') counts as present, so its rules still run. See
Optional Fields.
Three ways: a callback rule for a
one-off check, a mixed rule array,
or extend() for a reusable
named rule.
The value of a field can be an array — rules like
array, in,
min (element count) and
startWith understand arrays. For deeply nested
structures, validate each sub-array with its own setData() /
validation() cycle (see Recipes → Validate a list).
Yes — and you should. Configure the locale, labels, patterns and custom rules once; they survive every run. Only the rule queue and errors reset. See Recipes.
English (en, default) and Turkish (tr). You can override messages or load
your own language directory — see Localization.
PHP 8.1 and newer, with ext-mbstring. Older 7.x runtimes need the 1.x line.
No — there is no PSR for validation. The package is standalone and dependency-free.
- Troubleshooting — concrete problems and fixes.
- Rules Reference — the full rule catalogue.
initphp/validation · MIT License · part of the InitPHP family
Source · Issues · Discussions · Packagist · Contributing · Security Policy
Getting Started
Rules
Extending
Messages
Reference
Guides
Other