Pre-configured php formatter using php-cs-fixer
Add the following to your require part within the composer.json:
"comlaude/php-formatter": "^1.0.0"
$ php composer update
or
$ php composer require comlaude/php-formatter
Create a config folder in the root directory of your Lumen application and copy the content from vendor/comlaude/php-formatter/config/php-formatter.php to config/php-formatter.php.
Adjust the properties to your needs.
return [
// A flag to enable/disable caching mode
'cache' => false,
// See https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/3.0/doc/rules/index.rst for available rules and rulesets
'rules' => [
'@PSR2' => true,
'@DoctrineAnnotation' => true,
'whitespace_after_comma_in_array' => true,
],
// You can initialises your own ParallelConfig class here with your desired parameters
// default is set to detect the environment and use the appropriate resources
'parallel' => PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect(),
// this is used to call function on configuring a finder as defined here https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/3.0/doc/config.rst
'finder' => [
'include' => [],
'exclude' => ['bootstrap', 'vendor', 'storage'],
'name' => ['*.php'],
'notname' => ['*.blade.php'],
'in' => __DIR__ . '/../../../../',
];
php vendor/bin/php-formatter fix
php vendor/bin/php-formatter fix -v --dry-run
This package is open-sourced software licensed under the MIT license