laravel-rules maintained by bradietilley
Description
Fluent rules for form requests in Laravel
Author
Last update
2026/07/21 09:54
(dev-main)
License
Downloads
15
Laravel Rules
Fluent, chainable validation rules for Laravel.
Documentation
Full documentation is available at bradietilley.dev/laravel-rules.
Installation
composer require bradietilley/laravel-rules
use BradieTilley\Rules\Rule;
use Illuminate\Validation\Rules\Password;
return [
'email' => Rule::make()
->bail()
->when(
$this->method() === 'POST',
Rule::make()->required(),
Rule::make()->sometimes(),
)
->string()
->email()
->unique(
table: User::class,
column: 'email',
ignore: $this->route('user')?->id,
),
'password' => rule()
->bail()
->when(
$this->method() === 'POST',
rule()->required(),
rule()->sometimes(),
)
->string()
->password(
Password::min(8)->letters()->numbers(),
),
];
See the documentation for usage, customisation, and the optional ValidationRule helper.