jspaetzel / phpstyle
PHPStyle - Make prettier PHP fast
Installs: 654
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 2
Forks: 0
Open Issues: 0
Type:composer-plugin
Requires
- php: ^7.3|^8.0
- composer-plugin-api: ^1.0 || ^2.0
- nette/neon: ^3.3
- php-cs-fixer/shim: ^3.8
Requires (Dev)
- ext-json: *
- composer/composer: ^1.0 || ^2.0
- friendsofphp/php-cs-fixer: ^3.14
- phpunit/phpunit: ^9
README
A slim, opinionated wrapper around PHPCSFixer.
This comes preloaded with sane style choices for most PHP applications. You should be able to safely run it on most code out of the box.
🏗 Setup
- Require the package
composer require jspaetzel/phpstyle --dev
🗒 Note: This package is a composer plugin, when installed it will create an initial
phpstyle.neon
file and a managed.php-cs-fixer.dist.php
file in the root of your project. You may be prompted before this action takes place.
-
Review the
phpstyle.neon
configuration file. Feel free to make changes to this file at any time. -
Run php-cs-fixer to fix your code
./vendor/bin/php-cs-fixer fix
🗒 Note: php-cs-fixer is integrated with PHPStorm and other editors and so PHPStyle should work with them as well.
That's it, your code is styled!
⚙ Configuration
The configuration for PHPStyle takes inspiration from PHPStan and is a very simple neon configuration file. Just adjust your paths and php versions if needed, and you'll be good to go.
parameters: php: 7.1 risky: false paths: - src - tests excludePaths: - src/path/you/want/to/skip - src/or/a/file-to-skip.php
Want to enable more rules? change
risky: true
and then see what happens. But watch out, these are risky! ⚠