bigelephant/laravel-rules

Alternative way to define rules in laravel.
45 5
Install
composer require bigelephant/laravel-rules
PHP:>=5.3.0
Last Updated:Feb 5, 2013
Links: GitHub  ·  Packagist
Maintainer: Robbo

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 providers array:
	'BigElephant\LaravelRules\RuleServiceProvider',
  • Add the following to your aliases array:
	'Rule' => 'BigElephant\LaravelRules\RuleFacade',

Related Packages

reliese/laravel

Reliese Components for Laravel Framework code generation.

3,954,390 1,705
php-tmdb/laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the...

53,312 160
laravel-ja/laravel

The Laravel Framework.

5,667 17
kavenegar/laravel

laravel 4 and 5 kavenegar integration

366,462 86
laravel/laravel

The skeleton application for the Laravel framework.

64,738,171 84,935