A PHP-CS-Fixer ruleset to share across projects, inspired by this Tim MacDonald article.
Via Composer
$ composer require codinglabsau/php-styles
Create .php-cs-fixer.dist.php
in the root of the project:
<?php
$finder = PhpCsFixer\Finder::create()
->in([
__DIR__.'/app',
__DIR__.'/config',
__DIR__.'/database',
__DIR__.'/routes',
__DIR__.'/tests',
]);
return CodingLabs\styles($finder);
Note the second argument for styles
is an array of rules to override the defaults.
Do a dry run like this (handy for CI):
./vendor/bin/php-cs-fixer fix --dry-run
And do a proper fix like this:
./vendor/bin/php-cs-fixer fix
This package is opinionated to our preferred code style at Coding Labs and subject to change, so use with caution!
MIT. Please see the license file for more information.
Coding Labs is a web app development agency based on the Gold Coast, Australia. See our open source projects on our website.