定制 bigelephant/laravel-rules 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bigelephant/laravel-rules

Composer 安装命令:

composer require bigelephant/laravel-rules

包简介

Alternative way to define rules in laravel.

关键字:

README 文档

README

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',

统计信息

  • 总下载量: 45
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 4
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2013-02-05