rorymcdaniel/php-cs-fixer-config

There is no license information available for the latest version (v1.0.0) of this package.

PSR12 config for php-cs-fixer

v1.0.0 2020-09-28 11:27 UTC

This package is auto-updated.

Last update: 2024-04-28 19:12:03 UTC


README

This config file was created to match as closely as possible the PSR-12 standard since at present, php-cs-fixer does not yet have a preset for PSR-12.

Installation

composer require --dev rorymcdaniel/php-cs-config

CLI Usage

php-cs-fixer --config=vendor/rorymcdaniel/php-cs-fixer-config/.php_cs.php --verbose fix path/to/files

Creating a PHPStorm File Watcher

  • Install PHP-CS-Fixer brew install php-cs-fixer
  • Preferences -> Tools -> File Watchers
  • Click the + at the bottom and choose Custom template
  • Name: php-cs-fixer (or whatever you like, this is just a label)
  • File Type: PHP
  • Scope: Current File (this prevents it from changing files you are not working on)
  • Program: /usr/local/bin/php-cs-fixer
  • Arguments: --config=$ProjectFileDir$/vendor/rorymcdaniel/php-cs-fixer-config/.php_cs.php --verbose fix $FileDir$/$FileName$
  • Output paths to refresh: $FileDir$/$FileName$
  • Expand Working Directory and Environment Variables
  • Working Directory: $ProjectFileDir$
  • Advanced options: only check Trigger the watcher on external changes
  • Click OK to save
  • Make sure the checkbox for Enabled is checked PHP-CS-Fixer will now run on your code any time you save.