- What is kennedy-osaze/php-cs-fixer-config?
- It is a reusable PHP-CS-Fixer configuration package that ships an opinionated ruleset for consistent PHP and Laravel code style. Instead of maintaining your own fixer rules in every project, you install it with Composer and extend the provided configuration. It focuses on formatting and coding-standard rules handled by PHP-CS-Fixer.
- How do I install kennedy-osaze/php-cs-fixer-config with Composer?
- Install it as a development dependency with composer require --dev kennedy-osaze/php-cs-fixer-config. You normally only need it locally and in CI, not in production runtime dependencies. After installation, create or update your .php-cs-fixer.php file to load the package configuration. Refer to the package README for the exact class or factory name to use.
- How do I use this PHP-CS-Fixer config in a Laravel project?
- Add it to a Laravel project as a dev dependency and point your .php-cs-fixer.php config at the package's ruleset. Then run PHP-CS-Fixer over your app, config, routes, tests, and other PHP directories as needed. Because it is opinionated, you can start with the provided defaults and only override rules where your team disagrees. Review the first dry-run diff before applying fixes to an existing codebase.
- Does this package work with Laravel projects?
- Yes, the package is described as providing an opinionated ruleset for PHP and Laravel code style. It works through PHP-CS-Fixer, so Laravel support depends on running the fixer against your Laravel project files. There is no runtime integration with Laravel itself; it is a development tool.
- Can I customize the opinionated ruleset?
- The package is opinionated, but PHP-CS-Fixer configurations can usually be extended or overridden in your project-level config. You can keep the shared baseline and adjust individual rules or paths for your codebase. Check the README for the supported way to merge or override the provided ruleset. Avoid copying the whole ruleset if the package exposes an extendable config.
- How do I run PHP-CS-Fixer with this config?
- After wiring the package into .php-cs-fixer.php, run vendor/bin/php-cs-fixer fix to apply formatting. Use vendor/bin/php-cs-fixer fix --dry-run --diff first to preview changes in an existing project. You can target specific paths or use a config file with the --config option. Add the command to your Composer scripts or CI workflow for repeatable checks.
- Is this package compatible with different PHP-CS-Fixer versions?
- Compatibility depends on the PHP-CS-Fixer version required by the package and your project's PHP version. Check the package's composer.json constraints before installing, especially on older Laravel applications. Because fixer rules and config APIs can change between major PHP-CS-Fixer releases, pin compatible versions in CI. If you use a newer PHP-CS-Fixer major, verify the config still loads.
- Can I use this config in CI/CD pipelines?
- Yes, a shared PHP-CS-Fixer config is well suited to CI because it gives every project the same style baseline. Install dev dependencies and run php-cs-fixer in dry-run mode so the pipeline fails when files are not formatted. Cache Composer dependencies for speed and run the check on the same PHP version you use locally. Keep the package version pinned so rule changes do not break builds unexpectedly.
- What are alternatives to kennedy-osaze/php-cs-fixer-config?
- Alternatives include maintaining your own .php-cs-fixer.php ruleset, using Laravel Pint, or adopting other shared PHP-CS-Fixer config packages. Laravel Pint is convenient for Laravel-only projects, while this package is aimed at reusable PHP-CS-Fixer configuration across PHP and Laravel codebases. Choose based on whether you want Pint's workflow or direct PHP-CS-Fixer control. You can also combine a shared baseline with project-specific overrides.
- Should I use this package in production or only during development?
- It is a development-only coding-standard tool, so it should not be required in production runtime dependencies. For maintenance, check the repository's release activity, PHP-CS-Fixer version constraints, and issue history before adopting it long term. Pin a known-good version in composer.json and review changelogs when updating. In production, only the formatted application code matters, not the fixer package itself.