jspaetzel/phpstyle

This package is abandoned and no longer maintained. No replacement package was suggested.

PHPStyle - Make prettier PHP fast

Installs: 639

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 2

Forks: 0

Open Issues: 0

Type:composer-plugin

1.7.0 2023-06-27 22:36 UTC

This package is auto-updated.

Last update: 2024-01-27 23:58:35 UTC


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.

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