PHPackages                             symplify/easy-coding-standard - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. symplify/easy-coding-standard

ActiveLibrary[Testing &amp; Quality](/categories/testing)

symplify/easy-coding-standard
=============================

Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP\_CodeSniffer

13.2.3(2w ago)1.6k37.4M↓44.1%9220MITPHPPHP &gt;=7.2CI passing

Since Mar 1Pushed 1w ago20 watchersCompare

[ Source](https://github.com/ecsphp/ecs)[ Packagist](https://packagist.org/packages/symplify/easy-coding-standard)[ RSS](/packages/symplify-easy-coding-standard/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)DependenciesVersions (763)Used By (20)

The Easiest way to use Coding Standard
======================================

[](#the-easiest-way-to-use-coding-standard)

[![Downloads total](https://camo.githubusercontent.com/fc6c4db90af5f2574561e49cc104e37b7b28236358367e7da43e20e46d2904f4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73796d706c6966792f656173792d636f64696e672d7374616e646172642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/symplify/easy-coding-standard/stats)

Easy Coding Standard (ECS) is a single tool that runs [PHP\_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) and [PHP-CS-Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) rules together, configured through one simple PHP file.

Note

This is the **deployed** package. Development happens in the [ecs-src](https://github.com/easy-coding-standard/ecs-src) repository - report issues and send pull requests there.

Killer Features
---------------

[](#killer-features)

- Install on **any PHP 7.2-PHP 8.5** project with any dependencies
- Blazing fast with parallel run out of the box
- Use [PHP\_CodeSniffer or PHP-CS-Fixer](https://tomasvotruba.com/blog/2017/05/03/combine-power-of-php-code-sniffer-and-php-cs-fixer-in-3-lines/) - anything you like
- Use **prepared sets** and [PHP CS Fixer sets](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst) to save time

Install
-------

[](#install)

```
composer require symplify/easy-coding-standard --dev
```

Usage
-----

[](#usage)

```
vendor/bin/ecs
```

On the first run, ECS creates `ecs.php` config file with directories and first rule to kick off.

Then you can run again to see the suggested diffs:

```
vendor/bin/ecs
```

To actually **fix your code**, add `--fix`:

```
vendor/bin/ecs --fix
```

That's it!

Configure
---------

[](#configure)

Most of the time, you'll be happy with the default configuration. The most relevant part is configuring paths, checkers and sets:

```
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
use PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
    ->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])

    // start slow with sole rules
    ->withRules([
        ListSyntaxFixer::class,
    ])
    ->withConfiguredRule(
        ArraySyntaxFixer::class,
        ['syntax' => 'long']
    )

    // apply full set
    ->withPreparedSets(psr12: true);
```

Do you want to check all `*.php` files in your root (`ecs.php`, `rector.php` etc.)? Instead of listing them one by one, use `->withRootFiles()` method:

```
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
    ->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
    ->withRootFiles();
```

### Prepared Sets

[](#prepared-sets)

`->withPreparedSets()` bundles curated rule sets. Enable the whole `common` set, or pick single topics:

```
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
    ->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
    ->withPreparedSets(
        arrays: true,
        spaces: true,
        namespaces: true,
        docblocks: true,
        controlStructures: true,
        comments: true,
        casing: true,
        cleanup: true,
    );
```

SetWhat it covers`arrays`array syntax, spacing, trailing commas, indentation`spaces`whitespace, operator/type spacing, blank lines`namespaces`imports ordering, unused/needless-alias imports`docblocks`phpdoc tags, types, alignment, cleanup`controlStructures`control flow, casing, operators, class structure`comments`comment style, spacing, empty-comment cleanup`casing`native function/type, magic method, literal casing`cleanup`dead statements, useless returns/casts, unused closure importsOr enable everything at once with `->withPreparedSets(common: true)`.

Do you want to include one of sets from [php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/doc/ruleSets/index.rst)?

You can:

```
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
    ->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
    ->withPhpCsFixerSets(perCS20: true, doctrineAnnotation: true);
```

### Gradual Adoption with Levels

[](#gradual-adoption-with-levels)

Want to adopt a coding standard step by step instead of all at once? Use `with*Level()` methods to start from the safest rules and raise the level as your codebase catches up:

```
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
    ->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
    ->withSpacesLevel(0)
    ->withArrayLevel(0)
    ->withControlStructuresLevel(0)
    ->withDocblockLevel(0);
```

Each level enables the first N+1 rules from a curated list, ordered from safest to most invasive. Bump the number once your codebase is clean on the current level.

### How to Skip Files/Rules?

[](#how-to-skip-filesrules)

Love the sets of rules, but want to skip single rule or some files?

```
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
    ->withSkip([
        // skip single rule
        ArraySyntaxFixer::class,

        // skip single rule in specific paths
        ArraySyntaxFixer::class => [
            __DIR__ . '/src/ValueObject/',
        ],

        // skip directory by absolute or * mask
        __DIR__ . '/src/Migrations',

        // skip directories by mask
        __DIR__ . '/src/*/Legacy',
    ]);
```

### Less Common Options

[](#less-common-options)

You probably won't use these, but they can give you more control over the internal process:

```
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;

return ECSConfig::configure()
    // file extensions to scan
    ->withFileExtensions(['php'])

    // configure cache paths and namespace - useful e.g. Gitlab CI caching, where getcwd() produces always different path
    ->withCache(
        directory: sys_get_temp_dir() . '/_changed_files_detector_tests',
        namespace: getcwd() // normalized to directory separator
    )

    // print contents with specific indent rules
    ->withSpacing(indentation: Option::INDENTATION_SPACES, lineEnding: PHP_EOL)

    // modify parallel run
    ->withParallel(timeoutSeconds: 120, maxNumberOfProcess: 32, jobSize: 20);
```

Mentioned values are default ones.

### Controlling Output Format

[](#controlling-output-format)

You may want to use ECS to generate reports for third-party tooling.

We currently provide formatters for:

- `console`: Human-oriented printing à la PHP CS Fixer.
- `json`: A custom JSON blob for arbitrary tooling.
- `junit`: JUnit format to be used in different CI environments.
- `checkstyle`: Useful for Github Action Reports.
- `gitlab`: For Gitlab code quality reports or Code Climate tooling.

You can use the output format option as below

```
vendor/bin/ecs --output-format=checkstyle
```

FAQ
---

[](#faq)

### How do I clear cache?

[](#how-do-i-clear-cache)

```
vendor/bin/ecs --clear-cache
```

### How can I see all used rules?

[](#how-can-i-see-all-used-rules)

```
vendor/bin/ecs list-checkers
```

Do you look for json format?

```
vendor/bin/ecs list-checkers --output-format json
```

### Can I Use My [`.editorconfig`](https://editorconfig.org/)?

[](#can-i-use-my-editorconfig)

Mostly! By using `->withEditorConfig()` in `ecs.php`, ECS will automatically discover the `.editorconfig` file in the project's root directory. It will use any rules under `[*]` or `[*.php]` (the latter taking priority) and respect the settings for:

- `indent_style`
- `end_of_line`
- `max_line_length`
- `trim_trailing_whitespace`
- `insert_final_newline`
- [`quote_type`](https://github.com/jednano/codepainter#quote_type-single-double-auto)
    - Only `single` and `auto` are respected.
    - Warning: this is a proposed field, but not fully standard.

These settings will take precedence over similar rules configured through sets like PSR12, to avoid conflicting with other tooling using your `.editorconfig`.

How to Migrate from another coding standard tool?
-------------------------------------------------

[](#how-to-migrate-from-another-coding-standard-tool)

Do you use another tool and want to migrate? It's pretty straightforward - here is "how to":

- for [PHP\_CodeSniffer](https://tomasvotruba.com/blog/2018/06/04/how-to-migrate-from-php-code-sniffer-to-easy-coding-standard)
- and [PHP CS Fixer](https://tomasvotruba.com/blog/2018/06/07/how-to-migrate-from-php-cs-fixer-to-easy-coding-standard).

###  Health Score

79

—

ExcellentBetter than 100% of packages

Maintenance97

Actively maintained with recent releases

Popularity75

Solid adoption and visibility

Community58

Growing community involvement

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 77.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

756

Last Release

19d ago

Major Versions

8.3.48 → 9.0.0-BETA12020-11-14

9.4.70 → 10.0.0-beta12021-11-02

10.3.3 → 11.0.12022-06-13

11.5.0 → 12.0.02023-07-25

12.6.2 → 13.0.02025-11-06

PHP version history (9 changes)v1.4.0PHP ^7.1

v7.0.0PHP ^7.2

8.2.17PHP ^7.2|^8.0

8.3.0PHP &gt;=7.2

9.0.0-rc1PHP &gt;=7.3

v9.3.3PHP &gt;=7.1

11.1.25PHP &gt;=8.1

12.1.0PHP &gt;=8.2

13.0.1PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/924196?v=4)[Tomas Votruba](/maintainers/TomasVotruba)[@TomasVotruba](https://github.com/TomasVotruba)

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (311 commits)")[![samsonasik](https://avatars.githubusercontent.com/u/459648?v=4)](https://github.com/samsonasik "samsonasik (36 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (14 commits)")[![Kenneth-Sills](https://avatars.githubusercontent.com/u/132029135?v=4)](https://github.com/Kenneth-Sills "Kenneth-Sills (5 commits)")[![mspirkov](https://avatars.githubusercontent.com/u/63721828?v=4)](https://github.com/mspirkov "mspirkov (4 commits)")[![zonuexe](https://avatars.githubusercontent.com/u/822086?v=4)](https://github.com/zonuexe "zonuexe (3 commits)")[![acoulton](https://avatars.githubusercontent.com/u/416566?v=4)](https://github.com/acoulton "acoulton (2 commits)")[![f-schnabel](https://avatars.githubusercontent.com/u/29004905?v=4)](https://github.com/f-schnabel "f-schnabel (2 commits)")[![joelclermont](https://avatars.githubusercontent.com/u/298100?v=4)](https://github.com/joelclermont "joelclermont (2 commits)")[![llaville](https://avatars.githubusercontent.com/u/364342?v=4)](https://github.com/llaville "llaville (2 commits)")[![marcimat](https://avatars.githubusercontent.com/u/355431?v=4)](https://github.com/marcimat "marcimat (2 commits)")[![matteotrubini](https://avatars.githubusercontent.com/u/7964032?v=4)](https://github.com/matteotrubini "matteotrubini (2 commits)")[![christopherowen](https://avatars.githubusercontent.com/u/3221756?v=4)](https://github.com/christopherowen "christopherowen (1 commits)")[![leofeyer](https://avatars.githubusercontent.com/u/1192057?v=4)](https://github.com/leofeyer "leofeyer (1 commits)")[![OndraM](https://avatars.githubusercontent.com/u/793041?v=4)](https://github.com/OndraM "OndraM (1 commits)")[![parth391](https://avatars.githubusercontent.com/u/4966579?v=4)](https://github.com/parth391 "parth391 (1 commits)")[![peterfox](https://avatars.githubusercontent.com/u/1716506?v=4)](https://github.com/peterfox "peterfox (1 commits)")[![PhilETaylor](https://avatars.githubusercontent.com/u/400092?v=4)](https://github.com/PhilETaylor "PhilETaylor (1 commits)")[![philstutz](https://avatars.githubusercontent.com/u/77684337?v=4)](https://github.com/philstutz "philstutz (1 commits)")[![reinfi](https://avatars.githubusercontent.com/u/9324423?v=4)](https://github.com/reinfi "reinfi (1 commits)")

---

Tags

cicoding-standardcoding-styleparallelphppsr-12static analysisautomationCode stylefixer

### Embed Badge

![Health badge](/badges/symplify-easy-coding-standard/health.svg)

```
[![Health](https://phpackages.com/badges/symplify-easy-coding-standard/health.svg)](https://phpackages.com/packages/symplify-easy-coding-standard)
```

###  Alternatives

[phpstan/phpstan

PHPStan - PHP Static Analysis Tool

14.0k369.7M40.0k](/packages/phpstan-phpstan)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.9k82.2M7.7k](/packages/vimeo-psalm)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.5k](/packages/larastan-larastan)[wp-coding-standards/wpcs

PHP\_CodeSniffer rules (sniffs) to enforce WordPress coding conventions

2.8k47.8M2.2k](/packages/wp-coding-standards-wpcs)[phpstan/phpstan-symfony

Symfony Framework extensions and rules for PHPStan

79475.7M2.2k](/packages/phpstan-phpstan-symfony)[phpstan/phpstan-strict-rules

Extra strict and opinionated rules for PHPStan

70370.0M5.3k](/packages/phpstan-phpstan-strict-rules)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
