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 Custom Fixers

Php Cs Fixer Custom Fixers Laravel Package

kubawerlos/php-cs-fixer-custom-fixers

Custom fixers for FriendsOfPHP PHP-CS-Fixer. Install via Composer, register the Fixers set, then enable individual rules to enforce additional style conventions (e.g., prefer class constants, remove leading global namespace slashes, tidy PHPDoc params).

View on GitHub
Deep Wiki
Context7

A set of custom fixers for PHP CS Fixer

Frequently asked questions about Php Cs Fixer Custom Fixers
How do I install this package for Laravel projects?
Run `composer require --dev kubawerlos/php-cs-fixer-custom-fixers` in your Laravel project. The package is designed as a dev dependency, so it won’t affect production builds. Ensure your project uses PHP 7.4+ for full compatibility.
Can I use these fixers alongside Laravel’s default PHP CS Fixer config?
Yes, the package integrates directly with your existing `.php-cs-fixer.php` config. Call `registerCustomFixers()` and enable specific rules (e.g., `ClassConstantUsageFixer`) alongside PSR-12 or PSR-2 rules. Test with `--dry-run` first to avoid unexpected changes.
Which Laravel versions are supported?
This package works with Laravel 8+ and PHP 7.4+. Some fixers (e.g., `NoNullableBooleanTypeFixer`) may conflict with older Laravel versions (pre-5.5) due to PHP 7.4+ assumptions. Always validate with `--dry-run` before enforcing in CI.
How do I handle conflicts with existing codebases?
Start by running fixers in `--dry-run` mode to identify conflicts. Use the `Risky` flag in the docs to avoid problematic fixers (e.g., `IssetToArrayKeyExistsFixer`). For legacy code, consider opting out specific files or classes via config annotations.
Are these fixers safe for Laravel’s test suite?
Most fixers are safe, but some (e.g., `PhpUnitAssertArgumentsOrderFixer`) may break PestPHP or PhpUnit assertions. Test against your Laravel test suite before enforcing globally. Use `--diff` to preview changes and validate manually.
How do I integrate this into GitHub Actions for Laravel?
Add a step to your workflow using `vendor/bin/php-cs-fixer fix --diff --dry-run --rules=@PSR12,NoLeadingSlashInGlobalNamespaceFixer`. For pre-commit hooks, use `php-cs-fixer fix --allow-risky=yes` if needed, but avoid risky fixers in CI.
What’s the performance impact on large Laravel codebases?
Running all fixers on large codebases (e.g., Laravel’s test suite) can introduce CI overhead. Profile with `--dry-run` and `--stop-on-failure` to measure impact. Disable deprecated or risky fixers if performance is critical.
Are there alternatives for stricter Laravel code standards?
Native PHP CS Fixer rules (e.g., `@PSR12`) cover most standards, but this package adds opinionated fixes like `ClassConstantUsageFixer` or `NoUselessCommentFixer`. For Laravel-specific rules, consider `laravel-shift/php-cs-fixer-laravel` or custom configs.
How do I handle deprecated fixers in this package?
Deprecated fixers (e.g., `DataProviderNameFixer`) are marked in the docs. Plan to migrate to native PHP CS Fixer rules (e.g., `php_unit_data_provider_name`) when Laravel adopts them. Use `--dry-run` to test replacements incrementally.
Will these fixers break Laravel’s Doctrine ORM interactions?
Some fixers (e.g., `NoLeadingSlashInGlobalNamespaceFixer`) are safe, but others (e.g., `IssetToArrayKeyExistsFixer`) may conflict with Doctrine’s dynamic property access. Test with `--dry-run` and exclude problematic files if needed.
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.
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
anil/file-picker
broqit/fields-ai