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

beste/php-cs-fixer-config

Opinionated PHP-CS-Fixer configuration for BESTE projects, extending ergebnis/php-cs-fixer-config. Provides ready-to-use rulesets for modern PHP (Php81 and Php82) to keep code style consistent across your codebase.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the package in your project:
    composer require --dev beste/php-cs-fixer-config
    
  2. Create or update .php-cs-fixer.php to extend the shared config:
    <?php
    
    return (new Beste\PhpCsFixerConfig\Config())
        ->setUsingCache(true)
        ->setRiskyAllowed(true);
    
  3. Run the linter/fixer to verify it works:
    vendor/bin/php-cs-fixer fix --dry-run
    
  4. Optional: Configure CI (e.g., GitHub Actions) to enforce style via php-cs-fixer check.

Implementation Patterns

  • Per-project override: Use standard PHP-CS-Fixer methods like ->setRules([...]) or ->prependRule(...) for project-specific tweaks without duplicating the core rules.
  • CI enforcement: In CI, run vendor/bin/php-cs-fixer fix --dry-run --diff to fail builds on style violations.
  • Pre-commit hook: Integrate with tools like husky + lint-staged to auto-fix staged files:
    "lint-staged": {
      "*.php": ["vendor/bin/php-cs-fixer fix"]
    }
    
  • Multi-package repos: In monorepos (e.g., using Doctrine Monorepo Builder), require beste/php-cs-fixer-config once in root and reference it across subpackages via relative paths.

Gotchas and Tips

  • Risky rules: This package enables risky rules (e.g., php_unit_strict, php_unit_test_annotation). Explicitly set ->setRiskyAllowed(true) to avoid silent failures.
  • PHP version compatibility: The config targets modern PHP versions (likely ≥8.0). Adjust setPhpVersion() if supporting older versions:
    ->setPhpVersion(80100)
    
  • Caching: Enable caching (->setUsingCache(true)) to speed up repeated runs locally/CI — but ensure CI clears caches when rules change.
  • Extension points: Subclass Config in your project to add project-specific helpers (e.g., custom finder sets), then extend that class instead of copying rules.
  • Debugging: Run vendor/bin/php-cs-fixer describe to inspect enabled rules or verify rule changes after package updates.
  • Breaking changes: Since this is a shared config, updates may change rules. Pin to a specific version tag (e.g., ^1.2) to control upgrades.
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.
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
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope