sandermuller / laravel-fluent-validation-rector
Rector rules for migrating Laravel validation to sandermuller/laravel-fluent-validation
Package info
github.com/SanderMuller/laravel-fluent-validation-rector
Type:rector-extension
pkg:composer/sandermuller/laravel-fluent-validation-rector
Requires
- php: ^8.3
- rector/rector: ^2.5.2
- sandermuller/laravel-fluent-validation: ^1.32.0
- symplify/rule-doc-generator-contracts: ^11.2
Requires (Dev)
- laravel/pao: ^1.1
- laravel/pint: ^1.29
- mrpunyapal/rector-pest: ^0.2.7
- nikic/php-parser: ^5.4
- nunomaduro/collision: ^8.9.3
- orchestra/testbench: ^10.11||^11.0
- pestphp/pest: ^4.6.3
- pestphp/pest-plugin-arch: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- rector/type-perfect: ^2.0
- sandermuller/boost-skills: ^2.19
- sandermuller/package-boost-php: ^1.0
- spaze/phpstan-disallowed-calls: ^4.10
- symplify/phpstan-extensions: ^12.0
- tomasvotruba/cognitive-complexity: ^1.0
- tomasvotruba/type-coverage: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.1
- 1.4.0
- 1.3.0
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.0
- 0.22.3
- 0.22.2
- 0.22.1
- 0.22.0
- 0.21.1
- 0.21.0
- 0.20.2
- 0.20.1
- 0.20.0
- 0.19.1
- 0.19.0
- 0.18.0
- 0.17.1
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.1
- 0.14.0
- 0.13.3
- 0.13.2
- 0.13.1
- 0.13.0
- 0.12.1
- 0.12.0
- 0.11.0
- 0.10.1
- 0.10.0
- 0.9.0
- 0.8.1
- 0.8.0
- 0.7.0
- 0.6.1
- 0.6.0
- 0.5.3
- 0.5.2
- 0.5.1
- 0.5.0
- 0.4.19
- 0.4.18
- 0.4.17
- 0.4.16
- 0.4.15
- 0.4.14
- 0.4.13
- 0.4.12
- 0.4.11
- 0.4.10
- 0.4.9
- 0.4.8
- 0.4.7
- 0.4.6
- 0.4.5
- 0.4.4
- 0.4.3
- 0.4.2
- 0.4.1
- 0.4.0
- 0.3.2
- 0.3.1
- 0.3.0
- 0.2.0
- 0.1.1
- 0.1.0
This package is auto-updated.
Last update: 2026-08-30 08:52:31 UTC
README
Rector rules for migrating Laravel validation to sandermuller/laravel-fluent-validation. Pipe-delimited strings, array-based rules, Rule:: objects, and Livewire #[Rule] attributes all convert to FluentRule method chains.
// Before return [ 'email' => 'required|email|max:255', 'tags' => ['nullable', 'array'], 'tags.*' => 'string|max:50', ]; // After return [ 'email' => FluentRule::email()->required()->max(255), 'tags' => FluentRule::array()->nullable()->each( FluentRule::string()->max(50), ), ];
Tested on a production codebase: 448 files converted, 3,469 tests still passing.
Installation
composer require --dev sandermuller/laravel-fluent-validation-rector
Requires PHP 8.3+, Rector 2.5+, and sandermuller/laravel-fluent-validation ^1.32.0. On an older fluent-validation, see the pin table.
Getting started
// rector.php use Rector\Config\RectorConfig; use SanderMuller\FluentValidationRector\Set\FluentValidationSetList; return RectorConfig::configure() ->withPaths([__DIR__ . '/app']) ->withSets([FluentValidationSetList::ALL]);
vendor/bin/rector process --dry-run # preview vendor/bin/rector process # apply vendor/bin/pint # format
ALL runs converters, grouping and trait insertion. Three sets stay out of it on purpose and run as later passes: SIMPLIFY, POLISH, and SCHEMA.
Documentation
Full documentation lives at https://sandermuller.github.io/laravel-fluent-validation-rector/.
- Why this package? · Installation · Getting started · Sets
- String and array converters · Livewire attributes · Wildcard grouping · Trait insertion
- Simplify · Docblock polish · Adopting FluentSchema
- The
#[FluentRules]attribute · Configuration - Formatter integration · Diagnostics · Parity harness · AI assistant integration
- Rule reference · Detection and limitations
The sources are in docs/; the frozen public surface is in PUBLIC_API.md.
Testing
composer test # vendor/bin/pest composer qa # format → rector → phpstan → test
The suite runs against Orchestra Testbench, so no host Laravel app is required.
Changelog
Release notes live in CHANGELOG.md and on the releases page.
Contributing
See CONTRIBUTING.md for the dev setup, test workflow, and PR conventions.
Security
Disclose vulnerabilities privately. See SECURITY.md.
Credits
License
MIT. See LICENSE.md.