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 Redaxo\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
    ])
    
  • Granular finder 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.
  • PHP 8.5 migration sets: Leverage REDAXO 6.x-specific rule sets for PHP 8.5 compatibility by explicitly targeting the updated ruleset.

Gotchas and Tips

  • CS-Fixer version mismatch: The package now targets v3.95.3 of friendsofphp/php-cs-fixer. Ensure your local/global php-cs-fixer version aligns—check composer.lock for 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 8.5 compatibility: The REDAXO 6.x migration sets in this release include rules optimized for PHP 8.5 (e.g., ::class on objects, new attributes). Verify your 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;
    
  • Migration sets: For REDAXO 6.x projects, explicitly target the updated ruleset to ensure PHP 8.5 compatibility:
    ->setRuleset('redaxo:6.x') // Use this for REDAXO 6.x projects
    
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.
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui