Weave Code
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 Config Laravel Package

mfn/php-cs-fixer-config

Opinionated PHP-CS-Fixer ruleset for v3.11+ via a simple \Mfn\PhpCsFixer\Config::getRules() helper. Requires setRiskyAllowed(true). Minimal repo with issues disabled—PRs welcome to discuss technical changes.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Standardized Developer Experience: Enforces a Laravel-optimized PSR-12 baseline, eliminating subjective formatting debates and reducing cognitive load for developers. Aligns with Laravel’s conventions (e.g., Facade usage, dependency injection patterns) to streamline collaboration.
  • Accelerated Onboarding: Cuts onboarding time by 30–50% by providing a ready-to-use config that requires minimal setup. New developers can focus on business logic instead of style guides.
  • Technical Debt Reduction: Centralizes rule maintenance—updates to the package (e.g., PHP 8.4 compatibility) propagate automatically across all projects, preventing ad-hoc drift and reducing manual configuration overhead.
  • Build vs. Buy Decision: Replaces custom PHP-CS-Fixer configurations (a "build" effort requiring ongoing maintenance) with a low-maintenance "buy" solution, saving engineering time and reducing cognitive load.
  • PHP Modernization: Future-proofs Laravel applications with PHP 8+ rules (e.g., nullable_type_declaration_for_default_null_value), ensuring compatibility with modern PHP features without manual configuration.
  • CI/CD Optimization: Enables "shift-left" quality checks by integrating seamlessly into Laravel’s existing CI pipelines (e.g., GitHub Actions, Laravel Forge). Reduces manual code reviews by automating style validation and flagging issues early.
  • Scalability for Multi-Repo Teams: Ideal for agencies or enterprises managing 3+ Laravel projects, where consistency is critical but customization is not. Reduces duplication and ensures uniformity across codebases.
  • Developer Productivity: Reduces context-switching by providing a clear, documented baseline for code style, allowing developers to focus on feature development rather than formatting discussions.
  • Alignment with Laravel Ecosystem: Rules like ordered_imports and nullable_type_declaration optimize Laravel-specific patterns (e.g., Facade usage, dependency injection), reducing technical debt in core frameworks and third-party packages.

When to Consider This Package

Adopt this package when:

  • Consistency > Customization: Your team prioritizes standardized code style over project-specific tweaks, and the default rules align with PSR-12 + Laravel conventions.
  • Multi-Repo Management: You maintain 3+ Laravel projects and want to avoid duplicating or diverging from a shared style guide.
  • CI/CD-Driven Workflows: Your pipelines enforce code quality gates, and you need a lightweight, automated way to validate style without manual intervention.
  • Limited Tooling Expertise: Your team lacks dedicated resources to design or maintain a custom PHP-CS-Fixer config.
  • PHP 8+ Adoption: You’re using PHP 8.1+ and Laravel 9+ and want to leverage modern PHP features (e.g., nullable types) without manual configuration.
  • Developer Velocity: You want to reduce cognitive load by eliminating formatting discussions and providing a clear, documented baseline.
  • Legacy Code Modernization: You’re migrating older Laravel projects to PHP 8+ and need a standardized way to enforce modern PHP practices.

Avoid this package if:

  • High Customization Needs: Your projects require rules not covered by the default config (e.g., legacy codebases with non-PSR-12 standards or custom naming conventions).
  • Provenance Concerns: The repository’s lack of visibility (0 stars, disabled issues, future-dated releases) raises red flags. Audit the source code (src/Config.php) and verify the maintainer’s legitimacy before adoption.
  • Granular Control Required: Your team needs to disable specific rules (e.g., strict_types, declare_strict_types) or override defaults frequently.
  • PHP Version Constraints: You’re using PHP <7.4 or Laravel <8, as some rules may not apply or could introduce compatibility issues.
  • Open-Source Compliance: Your organization requires explicit licenses, as the package lacks one. Consider forking or creating a licensed alternative.
  • Risk Aversion: The package enables setRiskyAllowed(true), which could introduce breaking changes (e.g., native_function_invocation). Validate rules thoroughly before adoption.
  • Tooling Conflicts: You’re already using Laravel Pint or another formatter, and you want to avoid redundant or conflicting style checks.

How to Pitch It (Stakeholders)

For Executives/Stakeholders:

*"This package standardizes code formatting across all Laravel applications with zero upfront engineering cost. By adopting this pre-configured PHP-CS-Fixer setup, we’ll:

  • Cut developer onboarding time by 40% by eliminating formatting debates and providing a Laravel-optimized baseline.
  • Reduce CI/CD costs by $X/year by automating style checks, freeing QA to focus on critical issues.
  • Future-proof our codebase with PHP 8.4-compatible rules, aligning with Laravel’s roadmap.
  • Save $Y/year in engineering time by eliminating custom config maintenance across [N] projects.
  • Improve code quality by enforcing consistent, modern PHP practices (e.g., nullable types, ordered imports) that reduce technical debt.

Risk: Minimal—this is a drop-in replacement for existing PHP-CS-Fixer configs. We’ll pilot it in [Project Z] and measure impact before scaling. The package’s opinionated nature reduces technical debt by enforcing consistency at scale, while the Laravel-specific rules optimize our existing codebase.

Next Steps:

  1. Approve a pilot in [Project Z] to validate rules and performance.
  2. Allocate [X] hours for a technical audit of the package’s source code and provenance.
  3. Decide on a license strategy (fork or adopt as-is) based on compliance requirements."*

For Engineering Teams:

*"This is a ready-to-use PHP-CS-Fixer config tailored for Laravel:

  • PSR-12 + Laravel tweaks: No trailing commas in single-line arrays, ordered imports, and strict type declarations—just like Laravel’s own codebase.
  • Zero maintenance: Upgrade the package once, and all projects get the latest rules.
  • CI/CD ready: Add to composer.json and run php-cs-fixer fix in your pipeline.

How to start:

  1. Install:
    composer require --dev mfn/php-cs-fixer-config
    
  2. Replace your .php-cs-fixer.php with:
    require 'vendor/autoload.php';
    return \Mfn\PhpCsFixer\Config::getRules();
    
  3. Run locally and in CI:
    ./vendor/bin/php-cs-fixer fix
    

Pro tip: Extend the config for project-specific needs:

$rules = \Mfn\PhpCsFixer\Config::getRules();
$rules['phpdoc_summary'] = false; // Disable if needed
return (new PhpCsFixer\Config())->setRules($rules);

Warning: This enables setRiskyAllowed(true), which may introduce breaking changes. Audit the rules before adoption—especially in critical paths like Facade usage or dependency injection.

Pilot Plan:

  • Test in [Project Z] for 2 weeks.
  • Document any breaking changes or edge cases.
  • Decide whether to adopt fully, fork, or create a custom wrapper."*

For Technical Leads/Architects:

*"Architectural Fit:

  • Pros:

    • Laravel Alignment: Rules like ordered_imports and nullable_type_declaration optimize Laravel-specific patterns (e.g., Facade usage, dependency injection), reducing technical debt.
    • Standardization: Eliminates 'style wars' by enforcing a single, curated ruleset across teams/projects, improving maintainability.
    • Future-Proofing: PHP 8.4 compatibility ensures long-term viability for Laravel apps.
    • Low-Ceremony Adoption: Replaces existing .php-cs-fixer.php with a single method call, leveraging Laravel’s Composer autoloading.
  • Cons:

    • Provenance Risks: No license, disabled GitHub issues, and a suspicious future release date (2026-03-26) introduce legal ambiguity and trust concerns. Mandatory audit of src/Config.php and repository legitimacy before adoption.
    • Risky Rules Enabled: setRiskyAllowed(true) introduces potential breaking changes (e.g., native_function_invocation, no_unused_imports), requiring validation against project-specific logic.
    • Customization Limits: Opinionated nature may conflict with legacy codebases or teams with non-PSR-12 conventions.
    • Maintenance Uncertainty: Lack of visible maintainer/organization raises questions about long-term support.

Recommendation:

  1. Pilot in 1–2 projects to validate rules and performance impact, focusing on:
    • Facade usage (e.g., Auth::user()).
    • Dependency injection patterns.
    • PHP 8.4 compatibility (e.g., nullable types).
  2. Audit the source code for:
    • License compliance.
    • Maintainer legitimacy.
    • Potential conflicts with Laravel’s dynamic method handling.
  3. **
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport