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

Php Cs Fixer Laravel Package

fabpot/php-cs-fixer

Automatically fix PHP coding standards issues and unify style across your codebase. Includes rule sets like PER-CS, Symfony, and PhpCsFixer, plus configurable rules and migrations to modern PHP and PHPUnit. Supports PHP 7.4–8.5.

View on GitHub
Deep Wiki
Context7

A tool to automatically fix PHP Coding Standards issues

Frequently asked questions about Php Cs Fixer
How do I integrate PHP-CS-Fixer into a Laravel project’s CI/CD pipeline (e.g., GitHub Actions)?
Add a step to your workflow to run PHP-CS-Fixer with a dry-run first to catch violations. Example: `./vendor/bin/php-cs-fixer fix --dry-run --diff --rules=@PSR12`. For auto-fixing, use `--allow-risky=yes` in a separate job. Cache results with `--cache-file=.php-cs-fixer.cache` to speed up CI. Exclude `vendor/` and `bootstrap/cache` to avoid unnecessary checks.
Can PHP-CS-Fixer break Laravel-specific code (e.g., property-read annotations or dynamic properties)?
Yes, some rules like `class_attributes` or `no_unused_imports` may conflict with Laravel’s conventions. Override defaults in `.php-cs-fixer.php` by extending the config: `return (new PhpCsFixerConfig())->setRules([...])->setRiskyAllowed(true);`. Test fixes in a staging environment before enforcing in CI.
What’s the difference between PHP-CS-Fixer and Laravel Pint? Should I use both?
Pint focuses on *formatting* (whitespace, indentation) while PHP-CS-Fixer handles *semantic fixes* (e.g., PSR-12 compliance, type hints, modern PHP syntax). Use both: Pint for formatting, PHP-CS-Fixer for standards. Example workflow: Run Pint first, then PHP-CS-Fixer. Avoid redundancy by excluding Pint’s rules in PHP-CS-Fixer’s config.
How do I configure PHP-CS-Fixer to match Laravel’s coding standards (e.g., Taylor Otwell’s conventions)?
Start with `@PSR12` or `@Symfony` as a base, then override specific rules in `.php-cs-fixer.php`. Example: Disable `no_unused_imports` for Laravel’s dynamic facades. Use `php-cs-fixer init` to generate a config, then customize. Document your ruleset in the team’s style guide for consistency.
Will PHP-CS-Fixer slow down my Laravel application in production?
No, PHP-CS-Fixer runs *only* during development or CI—it’s a dev dependency with zero runtime impact. For large codebases, cache results with `--cache-file` or parallelize fixes with `--parallel`. Exclude `vendor/` and generated files (e.g., `bootstrap/cache`) to reduce processing time.
How do I handle legacy Laravel 5/6 code when introducing PHP-CS-Fixer?
Run `php-cs-fixer fix --dry-run` on legacy branches first to preview changes. Use `--path-mode=union` to apply fixes incrementally. For critical legacy code, exclude files temporarily with `--exclude='app/OldLegacyCode.php'`. Document grandfathered exceptions in your config comments.
Can I use PHP-CS-Fixer with Laravel Forge or Envoyer for deployment?
Yes, but only for pre-deployment checks—not runtime. Add a deploy hook in Forge/Envoyer to run `php-cs-fixer fix --dry-run` on the `release` directory. Fail the deploy if violations exist. Avoid auto-fixing in production to prevent unintended changes. Use `--diff` to review changes before applying.
What’s the best way to train my team on PHP-CS-Fixer fixes?
Start with the top 5 most common fixes (e.g., `array_syntax`, `class_attributes`, `no_unused_imports`) and document them in a team wiki. Use `php-cs-fixer fix --dry-run --verbose` to show examples. Host a workshop where developers run fixes on their local branches and discuss edge cases. Integrate with IDE plugins (PhpStorm/VS Code) for real-time feedback.
Does PHP-CS-Fixer support PHP 8.6, or should I stick to 8.5 for Laravel?
PHP-CS-Fixer officially supports up to PHP 8.5. For PHP 8.6, use `--allow-unsupported-php-version=yes` at your own risk, as it may introduce bugs. Laravel 10+ targets PHP 8.1+, so 8.5 is a safer choice. Monitor the [PHP-CS-Fixer GitHub](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) for updates or contribute to add support.
How do I exclude specific files or directories from PHP-CS-Fixer in Laravel?
Use the `--exclude` flag for CLI runs: `php-cs-fixer fix --exclude='vendor/,tests/Feature/Browser/*'`. For permanent exclusions, add a `path_mode` rule in `.php-cs-fixer.php`: `$config->setPathMode(PathMode::UP_TO_ROOT_DIRECTORY)->setExclude(['vendor/', 'bootstrap/cache/']);` Exclude generated files like migrations or model casts to avoid false positives.
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor