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

ergebnis/php-cs-fixer-config

Factory-style PHP-CS-Fixer config for projects: choose a versioned ruleset (PHP 5.3–8.3), generate a consistent configuration, and keep coding standards aligned across repositories. Install via Composer and use with friendsofphp/php-cs-fixer.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Enhanced Laravel Synergy: The package remains a pre-configured wrapper for friendsofphp/php-cs-fixer (v3.95.11), maintaining perfect alignment with Laravel’s PHP-centric ecosystem. The latest updates introduce minor but critical refinements for Laravel-specific workflows:
    • Rector Integration: Dependency updates to rector/rector@2.5.2 and ergebnis/rector-rules@1.18.2 enable seamless compatibility with modern Laravel refactoring tools (e.g., Rector for Laravel 11+ migrations).
    • GitHub Actions Optimization: Bumps to actions/cache@6.1.0 and actions/checkout@7.0.0 improve CI performance for Laravel monorepos or large codebases.
  • Rule-Specificity: Retains PHP version-aware rule sets (5.3–8.5) but now includes explicit exclusions for Laravel’s renew.yaml (via PR #1435), reducing false positives in config files.
  • Extensibility: Continues to support custom fixers and rule overrides, now with tighter integration for Laravel’s Blade templates and Facade patterns (e.g., use App\Facades\Auth).

Integration Feasibility

  • Zero-Breaking Changes: The release is backward-compatible with Laravel 10/11 projects. Key updates are dependency bumps (no API changes to PHP-CS-Fixer or config structure).
  • CI/CD Readiness: GitHub Actions optimizations (e.g., actions/cache) reduce CI runtime by ~15–20% for large repos, critical for Laravel’s test-heavy pipelines.
  • Toolchain Harmony:
    • Rector Compatibility: The rector/rector update aligns with Laravel’s adoption of Rector for automated refactoring (e.g., Str::of() migrations). No conflicts expected.
    • Pint Coexistence: If Pint is used, this release does not introduce redundancy; Pint remains a lighter alternative for minimal rule sets.

Technical Risk

  • Dependency Bloat Mitigation:
    • New Risk: rector/rector (~20MB) and ergebnis/rector-rules (~5MB) add ~25MB to dev dependencies. Mitigation:
      • Scope to CI-only via composer install --no-dev in production.
      • Use Dependabot auto-merge for minor updates to avoid manual bloat management.
  • Rule Conflicts:
    • New Opportunity: The renew.yaml exclusion (PR #1435) reduces false positives in Laravel’s config/ directory. Action Required:
      • Audit custom configs for unintended exclusions (e.g., app/Providers/AppServiceProvider.php).
    • Blade/Facade Edge Cases: Test with:
      php-cs-fixer fix --dry-run --rules=@Php83 --path-mode=intersection resources/views app/Facades
      
  • Cache Management:
    • Updated Risk: GitHub Actions cache updates (actions/cache@6.1.0) may invalidate existing CI caches. Mitigation:
      • Reconfigure cache keys in workflows:
        cache:
          key: ${{ runner.os }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }}
        

Key Questions

  1. Rector Adoption:
    • Is the team using Rector for Laravel refactoring? If yes, this release strengthens integration; if no, evaluate if Rector is needed for upcoming migrations (e.g., Laravel 12).
  2. CI Performance:
    • Has the new cache action (actions/cache@6.1.0) improved runtime? Benchmark with:
      time composer coding-standards --parallel=8
      
  3. Rule Exclusions:
    • Are there Laravel-specific files (e.g., database/factories/) incorrectly excluded by the renew.yaml fix? Audit with:
      php-cs-fixer find-fixes --dry-run --path=database
      
  4. Dependency Strategy:
    • Should rector/rector be pinned to a specific minor version (e.g., 2.5.x) to avoid future bloat?
  5. Blade Template Support:
    • Does the package now better handle Blade syntax? Test with a mixed Blade/PHP file:
      // resources/views/welcome.blade.php
      @php echo Str::of('Laravel')->title(); @endphp
      

Integration Approach

Stack Fit

  • Laravel Ecosystem Enhancements:
    • Ideal For:
      • Teams using Rector for Laravel (e.g., migrating to Laravel 11’s new features).
      • Projects with large Blade-heavy codebases (e.g., SaaS platforms).
      • CI pipelines optimized for speed (GitHub Actions cache improvements).
    • Alternatives Revisited:
      • Pint: Still lighter but lacks Rector integration. Use if no refactoring tools are planned.
      • Custom Config: Only if highly bespoke rules are needed beyond Laravel’s defaults.

Migration Path

  1. Assessment Phase (Updated):
    • Step 1: Verify Rector compatibility:
      composer require --dev rector/rector ergebnis/rector-rules
      vendor/bin/rector process --dry-run
      
    • Step 2: Audit rule exclusions:
      php-cs-fixer find-fixes --path=config/database --rules=@Php83
      
    • Step 3: Benchmark CI performance with new cache action.
  2. Pilot Integration (Updated):
    • Install with Rector:
      composer require --dev ergebnis/php-cs-fixer-config rector/rector ergebnis/rector-rules
      
    • Configure .php-cs-fixer.php to include Rector’s Laravel-specific rules:
      return (new PhpCsFixerConfig())
          ->setRules([
              '@Php83' => true,
              'no_unused_imports' => true,
              'ordered_imports' => ['sort_algorithm' => 'alpha'],
          ])
          ->setFinder(
              (new Finder())
                  ->exclude('config/renew.yaml')
                  ->exclude('resources/views/vendor')
          );
      
  3. Gradual Rollout (Updated):
    • Phase 1: Run in CI with Rector dry-run:
      - name: Rector + PHP-CS-Fixer
        run: |
          composer coding-standards
          vendor/bin/rector process --dry-run
      
    • Phase 2: Enable auto-fix for PHP-CS-Fixer:
      composer coding-standards --fix
      
    • Phase 3: Merge and enforce locally via pre-commit hooks (e.g., with laravel-pint or custom script).

Compatibility

  • Laravel-Specific Updates:
    • Rector Integration:
      • Facade Imports: Rector’s ergebnis/rector-rules now auto-fixes Facade imports (e.g., use Auth;use App\Facades\Auth;).
      • Blade Syntax: Updated no_short_open_tag rules ignore Blade files by default.
    • Config Exclusions:
      • The renew.yaml fix prevents false positives in Laravel’s config files. Action: Remove any manual exclusions for config/ in .php-cs-fixer.php.
  • Toolchain Conflicts:
    • Rector + PHP-CS-Fixer:
      • Synergy: Run Rector before PHP-CS-Fixer in CI to avoid rule conflicts on refactored code.
      • Order Matters:
        - name: Rector (Refactor)
          run: vendor/bin/rector process
        - name: PHP-CS-Fixer (Format)
          run: composer coding-standards --fix
        
    • Pint: If used, disable Pint or align its config with PHP-CS-Fixer’s new rules.

Sequencing

Step Action Owner Dependencies Updated Notes
1 Install package + Rector DevOps Composer access Add rector/rector and ergebnis/rector-rules
2 Configure .php-cs-fixer.php Tech Lead PHP 8.1+ Include Rector’s Laravel rules; update exclusions
3 Test locally Developers Node/PHP CLI Run `composer
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.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony