comlaude / php-formatter
Pre-configured php formatter
Installs: 10 152
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 10
Forks: 0
Open Issues: 0
Requires
- friendsofphp/php-cs-fixer: ^3.57
README
Pre-configured php formatter using php-cs-fixer
Installation
Composer
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
Integration
Lumen
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__ . '/../../../../', ];
Basic Usage
php vendor/bin/php-formatter fix
CI Automation usage
php vendor/bin/php-formatter fix -v --dry-run
License
This package is open-sourced software licensed under the MIT license