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

redaxo/php-cs-fixer-config

Opinionated PHP-CS-Fixer configuration for REDAXO projects. Ships a ready-to-use ruleset to standardize code style and enforce consistent formatting across your codebase, making it easier to keep teams aligned and reviews focused on logic, not whitespace.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the package via Composer:
    composer require --dev redaxo/php-cs-fixer-config
    
  2. Create .php-cs-fixer.php in your project root and extend the shared config:
    <?php
    
    return (new PhpCsFixer\Config())
        ->setRuleset('redaxo')
        ->setFinder(PhpCsFixer\Finder::create()->in(__DIR__));
    
  3. Run locally to auto-fix:
    vendor/bin/php-cs-fixer fix
    
  4. Add to CI by including a simple check step:
    vendor/bin/php-cs-fixer fix --dry-run --diff
    

Implementation Patterns

  • Project-wide adoption: Use the config as the single source of truth—commit .php-cs-fixer.php to ensure consistency.
  • Plugin integration: Combine with IDEs (e.g., PhpStorm, VS Code) via pre-commit hooks or IDE-level CS-Fixer integrations.
  • Granular overrides: Override specific rules per project if needed:
    ->setRules([
        'phpdoc_summary' => true,
        'blank_line_between_statements' => false, // disable if unwanted
    ])
    
  • Multiplefinder support: Use multiple .in() calls or custom finder logic to exclude vendor, tests, or generated files:
    ->setFinder(
        PhpCsFixer\Finder::create()
            ->in(['src', 'lib', 'boot.php'])
            ->notPath('vendor')
    );
    
  • CI automation: Embed the dry-run check in your pipeline to fail on style mismatches.

Gotchas and Tips

  • CS-Fixer version mismatch: The package targets compatible CS-Fixer versions (≥3.50). Ensure your local/global php-cs-fixer version aligns—check composer.lock for php-cs-fixer/php-cs-fixer constraints.
  • Rule precedence: Custom rules set after setRuleset('redaxo') override defaults. Avoid calling setRuleset() multiple times.
  • IDE caching issues: Some IDEs cache CS-Fixer rules; manually refresh or restart if auto-fix behavior seems inconsistent.
  • PHP version edge cases: The REDAXO ruleset may include rules requiring PHP ≥8.0 (e.g., ::class on objects). Verify target project’s PHP version compatibility.
  • Debugging: Use --verbose to see applied rules:
    vendor/bin/php-cs-fixer fix -vvv
    
  • Extensibility hook: The package exposes Redaxo\PhpCsFixer\Config::create()—perfect for advanced usage in custom config scripts:
    $config = Redaxo\PhpCsFixer\Config::create();
    $config->setRules([...]);
    return $config;
    
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