Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Code Style

Laravel Code Style Laravel Package

chiiya/laravel-code-style

Code style configurations for Laravel projects combining PHP-CS-Fixer, ECS, and Rector. Install via Composer, publish the config files with artisan, then adjust ECS, PHP-CS-Fixer, Rector, and PHPStan settings to match your project structure.

View on GitHub
Deep Wiki
Context7

Laravel Code Style delivers opinionated, ready-to-use code style configurations for Laravel projects, combining PHP-CS-Fixer, ECS, Rector, PHPStan, and GrumPHP in a single dev dependency. Install it via Composer, publish the configs with php artisan vendor:publish --tag="code-style-config", then tailor them to your project structure.

  • Preconfigured ecs.php, .php-cs-fixer.dist.php, rector.php, and phpstan.neon files
  • GrumPHP integration with PHP-CS-Fixer, ECS, and TLint tasks out of the box
  • Optional Rector and PHPStan tasks, ideal for CI pipelines
  • Simple publish-and-adjust workflow for any Laravel project
  • Requires PHP 8.1 or newer
Frequently asked questions about Laravel Code Style
What is chiiya/laravel-code-style used for?
chiiya/laravel-code-style provides opinionated code style and quality configurations for Laravel projects by combining PHP-CS-Fixer, ECS, Rector, and optional PHPStan. It publishes ready-made config files and can integrate with GrumPHP for automated pre-commit checks. It is intended as a dev dependency, not a runtime package.
How do I install chiiya/laravel-code-style in a Laravel app?
Install it as a dev dependency with composer require chiiya/laravel-code-style --dev. When Composer prompts you to create a GrumPHP configuration file, choose No. Then publish the configs with php artisan vendor:publish --tag=code-style-config and adjust them for your project.
Which Laravel and PHP versions are supported by laravel-code-style?
The package works with Laravel 8+ and requires PHP 8.1 or newer. The current safe version floor is 4.1.1. Avoid onboarding onto 4.0.0 or 4.1.0 with the Rector preset enabled.
Which version should I use to avoid the RequestStaticValidateToInjectRector bug?
Use version 4.1.1 or newer. Release 4.1.1 removes the defective RequestStaticValidateToInjectRector rule that shipped in 4.0.0 and survived into 4.1.0. If you explicitly referenced that rule by name in a withRules or skip list, remove the reference when upgrading because the class no longer exists.
How do I fix code changed by Rector in laravel-code-style 4.0.0 or 4.1.0?
Audit your Rector diffs for added Request $request parameters on non-controller methods such as event listeners, jobs, console commands, and service classes. Revert those changes and restore the request() helper where the transformation was invalid. Controllers are unaffected because Laravel method-injects controller actions. Also remove any explicit whitelist entry for RequestStaticValidateToInjectRector.
How do I publish the ECS, PHP-CS-Fixer, Rector, and PHPStan configs?
Run php artisan vendor:publish --tag=code-style-config after installing the package. This creates ecs.php, .php-cs-fixer.dist.php, rector.php, and phpstan.neon in your project. Adjust paths and rules in those files to match your project structure. You may need to reinitialize GrumPHP after publishing.
Does laravel-code-style add Rector and PHPStan tasks to GrumPHP by default?
No. The default GrumPHP config includes tasks for PHP-CS-Fixer, ECS, and TLint. Rector and PHPStan tasks are excluded by default because they can take a long time. You can add them to GrumPHP or run them separately in CI.
Can I customize the published code style rules for my Laravel project?
Yes. The published ecs.php, .php-cs-fixer.dist.php, rector.php, and phpstan.neon files are meant to be edited for your project-specific paths and rules. The modular publishable configs let you keep the package defaults where they fit and override where needed. Teams with explicit rule references should review them after upgrades.
What runtime risks come with Rector rules in a Laravel code style preset?
Rector rules encode assumptions about Laravel framework runtime behavior, so a wrong rule can produce code that passes static analysis and style checks but fails at runtime. The removed RequestStaticValidateToInjectRector could cause a fatal ArgumentCountError at dispatch time in listeners and jobs. Such defects are latent and may only appear in staging, production, or queued worker paths. Integration tests that actually dispatch jobs and events are the best guard.
Does laravel-code-style include CI/CD templates for GitHub Actions?
No, the package does not ship built-in CI/CD templates such as GitHub Actions workflows. You need to set up pipelines manually and decide whether to run Rector and PHPStan there. Running those slower checks separately from GrumPHP is a common way to keep local commits fast.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core