talira

Easy Coding Standard (ECS)

Runs PHP_CodeSniffer and PHP-CS-Fixer rules together, fast

open sourceMITfree

Easy Coding Standard (ECS) is a PHP command-line tool that runs PHP_CodeSniffer and PHP CS Fixer rules together, configured through one ecs.php file. The first run writes a config with your paths and a first rule; later runs show suggested diffs and --fix applies them. It ships prepared rule sets (PSR-12, PER Coding Style, Laravel Pint's preset, and topic sets for arrays, spacing, imports, docblocks and more) and runs in parallel. A bundled Go engine, used with --blink or automatically when every configured rule is covered, fixes large codebases in seconds. It installs as a dev dependency with Composer and works on PHP 7.2 to 8.5 projects.

Problems it solves

  • enforce a PHP coding style without configuring two separate tools
  • PHP-CS-Fixer is too slow on my large codebase
  • apply PSR-12 formatting to a PHP project in CI

Features

  • runs PHP_CodeSniffer and PHP-CS-Fixer rules in one tool
  • one ecs.php config, created on first run
  • prepared sets: PSR-12, PER Coding Style, Laravel and topic sets
  • parallel runs and a bundled Go engine (--blink)
  • works on PHP 7.2 to 8.5 projects

Alternatives

The same job

These do what Easy Coding Standard (ECS) does.

  1. Slevomat Coding Standard Extra PHP_CodeSniffer sniffs for safer, cleaner and consistently formatted PHP
  2. PHP_CodeSniffer Detect and fix coding standard violations in PHP
  3. laminas-coding-standard The Laminas Project's PHP_CodeSniffer coding standard ruleset, built on PSR-12
  4. WordPress Coding Standards for PHP_CodeSniffer PHP_CodeSniffer rules that enforce WordPress coding conventions
  5. PHPLint Lint PHP files faster by running several lint processes at once
  6. Airbnb JavaScript Style Guide Airbnb's JavaScript style guide and the ESLint configs that enforce it

Compare Easy Coding Standard (ECS) with the top 3