Download the PHP package frbit/validator-loader without Composer
On this page you can find all versions of the php package frbit/validator-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download frbit/validator-loader
More information about frbit/validator-loader
Files in frbit/validator-loader
Package validator-loader
Short Description Load Laravel validator definitions from files or directories
License MIT
Informations about the package validator-loader
Laravel Validation Loader
Load Laravel validator definitions from files or directories (or wherever you want to store them).
The general idea is to centralize validation (rules) to simplify maintenance and maximize re-usability.
For the service provider, integrating the loader neatly into Laravel, look here.
Features
- Provides simple inheritance, for re-usable validation rules
- Allows variable usage, to keep the validations clean and readable
- Supports out of the box: JSON, YAML or native PHP files. Or directories containing such files.
- Flexible, extendable interface
- Can be used outside of Laravel
Installation
Example
That's how you use it:
And this is how the file (structure) looks like:
Validator files in directories
The more complex your application becomes and the more validation rules you need, the more it makes sense split the rules into multiple files.
Each named validator (and variable) name must be unique across all files.
Validator definition from array
If you need the flexibility.
Using custom validation methods
Custom validation rules, with the same signature as the Validator::extend method, can be added either in the definition (file) or programmatically. Once added, they are automatically available in all named validators.
Definition file
Programmatically
All versions of validator-loader with dependencies
illuminate/validation Version 4.2.*
illuminate/translation Version 4.2.*