| Package Data | |
|---|---|
| Maintainer Username: | Robbo |
| Maintainer Contact: | robert@mercenarydesign.net (Robbo) |
| Package Create Date: | 2013-02-05 |
| Package Last Update: | 2013-02-05 |
| Language: | PHP |
| License: | Unknown |
| Last Refreshed: | 2025-11-06 15:15:00 |
| Package Statistics | |
|---|---|
| Total Downloads: | 45 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 5 |
| Total Watchers: | 4 |
| Total Forks: | 2 |
| Total Open Issues: | 1 |
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.
$rules = [
'username' => 'required|alphaDash|between:3,100',
'email' => 'required|email',
'password' => 'required|confirmed|min:5',
'terms' => 'accepted',
];
$rules = [
'username' => Rule::required()->alphaDash()->between(3, 100),
'email' => Rule::required()->email(),
'password' => Rule::required()->confirmed()->min(5),
'terms' => Rule::accepted(),
];
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...
providers array: 'BigElephant\LaravelRules\RuleServiceProvider',
aliases array: 'Rule' => 'BigElephant\LaravelRules\RuleFacade',