palmtree / php-cs-fixer-config
PHP CS Fixer config for Palmtree components
v2.1.1
2023-11-15 14:30 UTC
Requires
- php: >=7.4
- friendsofphp/php-cs-fixer: ^3.0
README
PHP-CS-Fixer config for Palmtree components
Requirements
- PHP >= 7.1
Installation
Use composer to add the package to your dev dependencies:
composer require palmtree/php-cs-fixer-config --dev
"scripts": { "sniff": "vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no --diff --diff-format=udiff", "fix": "vendor/bin/php-cs-fixer fix --diff", }
Usage
Create a .php_cs.dist
file in your project's root directory.
You can copy a typical config file from this repository if desired:
$ cp vendor/palmtree/php-cs-fixer-config/.php_cs.dist .
Add the following entries to your .gitignore
file:
/.php_cs.cache
/.php_cs
Fixing Issues
Manually
To fix issues manually, run the following command:
$ composer fix
To perform a dry run, run the following command:
$ composer sniff
Pre-commit hook
Run the following to have PHP-CS-Fixer run on changed files before every commit:
$ cp vendor/palmtree/php-cs-fixer-config/git-hooks/pre-commit .git/hooks/pre-commit $ chmod +x .git/hooks/pre-commit
License
Released under the MIT license