Selection guide

Choosing code-quality tools for Laravel

Build a Laravel quality workflow with formatting, framework-aware type analysis, architectural checks, and reviewed refactoring.

Formatting: Laravel Pint

Start with a consistent formatting policy. Laravel Pint provides PHP-CS-Fixer-based presets with little initial configuration, so style review can be automated before human code review.

Official documentation:

Framework-aware analysis: PHPStan and Larastan

Larastan extends PHPStan for Laravel conventions such as facades and framework-provided types. Check its compatibility table against the project's Laravel and PHP versions before installing it.

Choose an initial analysis level you can maintain. For existing applications, baseline current findings and tighten checks gradually rather than hiding every finding with a blanket ignore.

Official documentation:

Architecture: enforce the boundaries you use

If the application has layers or modules, Deptrac can check allowed dependency relationships. Define rules from the application's intended architecture and keep the dependency map aligned with code changes.

Official documentation:

Refactoring: review automated changes

Rector applies automated PHP refactoring and upgrade rules. Choose rules that match the migration you are performing, inspect their changes, and run the application's tests before accepting the result.

Introduce these tools incrementally. Formatting, static analysis, architectural checks, and refactoring serve different tasks; only keep checks that produce useful feedback for this application.

Official documentation: