bigelephant/laravel-rules
Laravel Rules
Alternative way to define rules in laravel.
This is just for a more PHP like syntax on rules with laravel. I personally find it easier to read at a glance. Also designed to be used in your own validators.
Normal rules in Laravel
$rules = [
'username' => 'required|alphaDash|between:3,100',
'email' => 'required|email',
'password' => 'required|confirmed|min:5',
'terms' => 'accepted',
];
Under this new syntax
$rules = [
'username' => Rule::required()->alphaDash()->between(3, 100),
'email' => Rule::required()->email(),
'password' => Rule::required()->confirmed()->min(5),
'terms' => Rule::accepted(),
];
Installation
Add the following to the "require" section of your composer.json file:
"bigelephant/laravel-rules": "dev-master"
Edit the app/config/app.php file and...
- Add the following to your
providersarray:
'BigElephant\LaravelRules\RuleServiceProvider',
- Add the following to your
aliasesarray:
'Rule' => 'BigElephant\LaravelRules\RuleFacade',
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
641,106,524
9,700
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
418,291,778
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
394,964,158
4,660