Download the PHP package jedrzej/validator-extended-syntax without Composer
On this page you can find all versions of the php package jedrzej/validator-extended-syntax. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jedrzej/validator-extended-syntax
More information about jedrzej/validator-extended-syntax
Files in jedrzej/validator-extended-syntax
Package validator-extended-syntax
Short Description Laravel 4/5 package that adds validator negation to Laravel's validation module
License MIT
Homepage https://github.com/validator-extended-syntax
Informations about the package validator-extended-syntax
Extended Validation for Laravel 5
This package extends Laravel's validation syntax with the following:
- aliasing validation rule configurations
- negating validation rules
- using automatically replaced placeholders
Composer install
Add the following line to composer.json
file in your project:
"jedrzej/validator-extended-syntax": "0.0.3"
or run the following in the commandline in your project's root folder:
composer require "jedrzej/validator-extended-syntax" "0.0.3"
Usage
In order to extend validator syntax, you need to register ValidationServiceProvider
in your config/app.php
:
Aliasing validation rules
It is possible to alias often used rule configuration to allow for reuse. This is an alternative to writing custom validation rules.
Negating validation results
When defining validation rules, you can negate chosen rule by prepending its name with exclamation mark. Negated validation rules will fail when not negated rule would pass and vice versa.
Placeholders in validation rules
If validation of one field needs to use the value of another field as parameter, you can use a {{parameter_name}}
placeholder in rule definition instead of parameter value.
Value of corresponding field will be passed to validator instead of the placeholder. If the corresponding value is missing in
validated data set, the value will be taken from Config. If it's missing in config, NULL
will be used.