PHPackages                             gabrieljmj/laravel-rule-sets - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. gabrieljmj/laravel-rule-sets

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

gabrieljmj/laravel-rule-sets
============================

Avoid repeating rules sets through requests.

v1.2.0(5y ago)21.8k↓33.3%[1 PRs](https://github.com/gabrieljmj/laravel-rule-sets/pulls)MITPHPPHP &gt;=7.2CI failing

Since Jan 23Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/gabrieljmj/laravel-rule-sets)[ Packagist](https://packagist.org/packages/gabrieljmj/laravel-rule-sets)[ RSS](/packages/gabrieljmj-laravel-rule-sets/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (5)Used By (0)

Laravel Rule Sets
=================

[](#laravel-rule-sets)

[![Travis (.com)](https://camo.githubusercontent.com/52d1a0e87e77dd7750dafc20fd8cef9d066c855b05c41f6a5f15d206241e22b7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f6761627269656c6a6d6a2f6c61726176656c2d72756c652d73657473)](https://camo.githubusercontent.com/52d1a0e87e77dd7750dafc20fd8cef9d066c855b05c41f6a5f15d206241e22b7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f6761627269656c6a6d6a2f6c61726176656c2d72756c652d73657473) [![Packagist](https://camo.githubusercontent.com/f4da02e4533a20a77775148cee5962714a9bea6c72a45115edac2554cc35d1c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6761627269656c6a6d6a2f6c61726176656c2d72756c652d73657473)](https://camo.githubusercontent.com/f4da02e4533a20a77775148cee5962714a9bea6c72a45115edac2554cc35d1c0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6761627269656c6a6d6a2f6c61726176656c2d72756c652d73657473)

Avoid repeating validation rules sets. With this library it is possible to share rules between sets and reuse sets through requests.

Installing
----------

[](#installing)

### Composer

[](#composer)

Execute the following command:

```
composer require gabrieljmj/laravel-rule-sets

```

#### For Laravel before 5.5

[](#for-laravel-before-55)

It is necessary to add the service provider to the providers list at `config/app.php`:

```
Gabrieljmj\LaravelRuleSets\Providers\RuleSetsServiceProvider::class,
```

Usage
-----

[](#usage)

The package provides the artisan command `make:rule-set`. It will generate a RuleSet at the namespace `App\Rules\RuleSets`.

```
artisan make:rule-set UserRuleSet

```

Add the necessary rules at the protected method `rules` of the set.

```
