eliashaeussler/rector-config
Opinionated, reusable Rector configuration for PHP/Laravel projects. Provides curated rule sets and sensible defaults to quickly add automated refactoring and code upgrades, with easy integration into existing Rector setups.
Start by requiring the package via Composer in your project:
composer require --dev eliashaeussler/rector-config
Then create or update rector.php in your project root with a single line to include the shared configuration:
return \EliasHaeussler\RectorConfig\Loader\DefaultConfigLoader::load(__DIR__);
That’s it — Rector now runs with sensible defaults including PHP 8.0+ upgrades, null safety improvements, and modern syntax migrations. Run a dry-run first to preview changes:
vendor/bin/rector process src --dry-run
rector.php extension to enable stricter sets (e.g., php82, code-quality) gradually per release cycle.rector job in your GitHub/GitLab CI to auto-refactor or fail if changes are needed:
- vendor/bin/rector process src --dry-run
rector:process before commits (via pre-commit hook or IDE integration) to automatically adopt current best practices.--debug flag to trace rule interactions.DefaultConfigLoader merges rules before your project’s local rector.php config; use ->withConfiguredRule() for targeted overrides.--clear-cache) when config changes unexpectedly behave inconsistently across runs.DefaultConfigLoader and override methods to inject project-specific paths, custom sets, or exclude patterns — great for complex legacy apps.How can I help you explore Laravel packages today?