jspaetzel / phpstyle

Write prettier PHP faster!

Home Page:https://php.style

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHPStyle ✨

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.

https://php.style/

πŸ— Setup

  1. 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.

  1. Review the phpstyle.neon configuration file. Feel free to make changes to this file at any time.

  2. 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! ⚠

About

Write prettier PHP faster!

https://php.style

License:MIT License


Languages

Language:PHP 100.0%