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

Php Cs Fixer Laravel Package

friendsofphp/php-cs-fixer

PHP CS Fixer automatically detects and fixes coding standards issues in your PHP code. Choose from built-in rule sets like @PER-CS, @Symfony, or @PhpCsFixer, or define your own style, and modernise your codebase with ease.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy on code-style enforcement. This is a solved problem with a 13.5k-star, MIT-licensed, actively released engine already underpinning the Laravel default (Laravel Pint wraps PHP-CS-Fixer). The only defensible "build" decision is a thin team-specific config file over this engine; building a formatter is not a roadmap item.
  • Feature definition of done. Gives you a mechanical, non-negotiable answer to "is this PR ready?" Style becomes a CI gate instead of a review comment, which shortens review cycles and removes a recurring source of reviewer/author friction.
  • Platform upgrade roadmaps (PHP and PHPUnit). The @autoPHPMigration, @autoPHPMigration:risky, and @autoPHPUnitMigration:risky rule sets mechanically rewrite code toward newer PHP and PHPUnit idioms. This directly de-risks and compresses the schedule of a PHP 8.x or test-suite modernization initiative — the kind of work that otherwise gets estimated in engineer-weeks of manual, error-prone edits.
  • Onboarding and contractor cost. A committed .php-cs-fixer.php is executable documentation of house style; new hires and agency contributors converge on conventions without a style guide review, which measurably reduces ramp time on a mature Laravel codebase.
  • Merge-conflict and diff-noise reduction. Whitespace/ordering drift is a leading cause of trivial rebase conflicts across parallel feature branches. Enforcing a fixer set cuts that class of toil and makes git log/blame more legible (with a .git-blame-ignore-revs entry for the initial reformat commit).
  • Tooling consolidation bet. Choosing this as the single source of truth lets you drop overlapping one-off formatters and IDE-specific configs, and gives you one place to encode style decisions as the team's conventions evolve.
  • Sequencing against static analysis. This pairs with, not replaces, PHPStan/Larastan. A PM should sequence style enforcement first (auto-fixable, low controversy, quick win) and static analysis second (requires baseline ratcheting), because the first builds the CI habit the second depends on.
  • Not a differentiator. The high maturity score and comparatively lower "opportunity" score are the signal: this is table stakes infrastructure. Fund it as a small, low-risk hygiene investment; do not position it as a competitive capability or a headline roadmap item.

When to Consider This Package

Adopt when most of the following hold:

  • More than one engineer commits PHP to the same repository, or external contributors/agencies do.
  • A CI pipeline exists (or is being built) that can run php-cs-fixer check as a required, non-blocking-to-author gate.
  • The codebase is long-lived enough that upgrade migrations are on the roadmap — the auto-migration rule sets pay for themselves on the first PHP minor upgrade.
  • You need rules beyond what Pint exposes, or you want per-directory rule sets (e.g. stricter rules for app/, relaxed for legacy tests/ fixtures).
  • You are already on Pint but hitting its ceiling: Pint is a curated subset, so wanting explicit rule-by-rule control, custom fixers, or a different rule-set lineage (@PER-CS, @Symfony, @PhpCsFixer) is a valid trigger to move down a layer.

Look elsewhere, or defer, when:

  • A solo developer on a small or short-lived codebase. The reformat diff cost exceeds the review-friction savings.
  • Pint already ships with your Laravel version and satisfies you. Staying on Pint is the lower-ops-choice; adopting the engine directly buys config granularity at the cost of owning configuration and rule-set drift yourself. Frame this as an explicit trade, not an upgrade.
  • The need is code quality, not code style. Correctness, type safety, dead code, and architecture violations are PHPStan/Larastan, Rector (for broader automated refactoring), or review territory. This tool will not find bugs.
  • The codebase is frozen or being rewritten. Reformatting code scheduled for deletion is pure cost.
  • You cannot tolerate automated rewrites of executable semantics. The :risky rule sets can change behavior; if there is no test coverage to catch regressions, restrict to non-risky sets or wait.
  • PHP version support gaps matter. New PHP releases lag; if you are an early adopter of an unreleased PHP version, verify support before making this a hard CI gate (the unsupported-version escape hatch is a stopgap, not a policy).
  • Non-PHP surfaces. Blade templates, front-end assets, and SQL migrations are out of scope; don't let adoption create an expectation that "style is handled" project-wide.

How to Pitch It (Stakeholders)

For executives: This is a free, MIT-licensed, industry-standard utility that our primary framework already builds on. It automates code formatting and portions of PHP/PHPUnit version upgrades — the mechanical work that currently consumes senior engineer hours and delays platform upgrades. Cost is near zero; the return is measurable in reduced review time, faster onboarding, and shorter upgrade cycles. It is hygiene, not a differentiator, so I'm proposing it as a small scoped initiative with a single guardrail: land the initial reformat as one isolated commit so we don't pollute history or attribution.

For engineering: One committed config file, one CI check, one autofix command. We standardize on a community rule set (@PER-CS or @Symfony) rather than an in-house opinion so we inherit upstream maintenance instead of owning it. Rollout in three steps: (1) land fix as a single whitespace-only commit with a .git-blame-ignore-revs entry; (2) add check to CI as required; (3) enable a pre-commit or IDE-on-save hook so authors fix locally before pushing. Risky rule sets are opt-in per directory and only where test coverage is solid. We keep Pint as the runner if it already meets our needs — the decision is which layer we configure, not whether to format at all.

Key risks to state up front: the initial reformat touches nearly every file (mitigated by commit isolation and a quiet period on long-lived branches); rule-set changes between minor versions can alter output (mitigated by pinning the version in composer.json and treating upgrades as reviewed PRs); and this does not replace static analysis, so it should not be positioned internally as a quality gate on its own.

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.
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names