hellochef-me / php-styles
HelloChef shared PHP style rules for PHP-CS-Fixer
Installs: 45 338
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
README
HelloChef PHP Code Styles
Shared PHP style rules for PHP-CS-Fixer
Install the package
composer require hellochef-me/php-styles
Create and setup config file in project root .php-cs-fixer.php
<?php return HelloChef\CodeStyles\PhpStyles::style();
Optionally, you may add php-cs-fixer cache file to your .gitignore
// .gitignore
.php-cs-fixer.cache
Format code on demand
- Format the whole project
vendor/bin/php-cs-fixer fix .
- Format specific file
vendor/bin/php-cs-fixer fix Path/To/ExampleFileToFormat.php
Format code on commit
Add the following scripts to your composer.json
"scripts": { "post-update-cmd": [ "cp vendor/hellochef-me/php-styles/pre-commit .git/hooks/pre-commit", "chmod a+x .git/hooks/pre-commit" ], "post-install-cmd": [ "cp vendor/hellochef-me/php-styles/pre-commit .git/hooks/pre-commit", "chmod a+x .git/hooks/pre-commit" ], },