PHPackages                             armin/editorconfig-cli - 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. [CLI &amp; Console](/categories/cli)
4. /
5. armin/editorconfig-cli

ActiveLibrary[CLI &amp; Console](/categories/cli)

armin/editorconfig-cli
======================

EditorConfigCLI is a free CLI tool (written in PHP) to validate and auto-fix text files based on given .editorconfig declarations.

2.2.1(5mo ago)211.4M—9.5%5[4 issues](https://github.com/a-r-m-i-n/editorconfig-cli/issues)[2 PRs](https://github.com/a-r-m-i-n/editorconfig-cli/pulls)20MITPHPPHP ^8.2CI passing

Since Feb 12Pushed 5mo ago1 watchersCompare

[ Source](https://github.com/a-r-m-i-n/editorconfig-cli)[ Packagist](https://packagist.org/packages/armin/editorconfig-cli)[ Docs](https://github.com/a-r-m-i-n/editorconfig-cli)[ RSS](/packages/armin-editorconfig-cli/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (31)Used By (20)

Editorconfig Checker for CLI
============================

[](#editorconfig-checker-for-cli)

[![Code Checks](https://github.com/a-r-m-i-n/editorconfig-cli/actions/workflows/code-checks.yml/badge.svg)](https://github.com/a-r-m-i-n/editorconfig-cli/actions/workflows/code-checks.yml)

EditorConfigCLI (binary name `ec`) is a free PHP-based command-line tool that **validates and auto-fixes** text files according to your project's **.editorconfig** rules.

This ensures that your **CI pipelines and development workflows** consistently enforce all relevant `.editorconfig`rules automatically.

**armin/editorconfig-cli** is released under [MIT license](LICENSE).

Written by **Armin Vieweg** &lt;&gt;

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Enabled PHP extensions: iconv, json

If you require support for older PHP versions, you can check out and use those tags:

- [PHP 7.4, 8.0, 8.1 or 8.2](https://github.com/a-r-m-i-n/editorconfig-cli/tree/1.x) (Branch 1.x)

Installation
------------

[](#installation)

You can install EditorConfigCLI by either [downloading the PHAR executable](https://github.com/a-r-m-i-n/editorconfig-cli/releases)or installing it via Composer:

```
$ composer req --dev armin/editorconfig-cli

```

**Tip:** You can also install the tool globally using `composer global`.

To download the PHAR executables, check out the releases section [here](https://github.com/a-r-m-i-n/editorconfig-cli/releases).

What is EditorConfig?
---------------------

[](#what-is-editorconfig)

[![EditorConfig logo](docs/images/editorconfig-logo.png)](docs/images/editorconfig-logo.png)

> EditorConfig helps maintain consistent coding styles for multiple developers working on the same project across various editors and IDEs.

The coding styles to be enforced are defined in your project’s **.editorconfig** file.

You'll find more info about syntax and features of EditorConfig on

Screenshots
-----------

[](#screenshots)

This screenshot shows the help page you get when calling `ec --help`:

[![Screenshot of Help page](docs/images/ec-2.0.png)](docs/images/ec-2.0.png)

Here you see two example runs:

[![Demo run animation](docs/images/ec-demo.gif)](docs/images/ec-demo.gif)

Features
--------

[](#features)

- Parsing `.editorconfig` file
- Validating files against corresponding `.editorconfig` declarations
- Several modes to iterate through your project files
- Automatic fixing of detected issues
- The following EditorConfig declarations (also called "rules") are being processed:
    - EndOfLine
    - InsertFinalNewLine
    - TrimTrailingWhitespace
    - Indention
        - Style (tab/spaces)
        - Size (width)
    - Charset (*check only*)
    - MaxLineLength (*check only*)
- Optional strict mode (`--strict`) to enforce the configured space indentation size. *(Note: This may conflict with other linters enforcing more granular indentation rules.)*
- Allow skipping certain rules (e.g. `--skip charset,eol`)
- List files, currently uncovered by given `.editorconfig` declarations (`--uncovered`)

Usage
-----

[](#usage)

Composer style:

```
$ vendor/bin/ec [options] [--] [...]

```

PHAR style:

```
$ php ec-2.0.0.phar [options] [--] [...]

```

### Scanning

[](#scanning)

If no options are provided, the scan starts automatically when invoking the `ec` binary.

EditorConfigCLI supports **three modes** for discovering files to check:

1. **By CLI arguments and options**, using a preconfigured `symfony/finder` instance (default mode).

    *Note:* No dotted files and directories are getting scanned (e.g. `.ddev/` or `.htaccess`). Also, files covered by root `.gitignore` file, will be automatically excluded from scan.
2. **Git-based mode**, which retrieves all files tracked by Git.

    *Note:* Most CLI args and options are ignored, then. You can still filter files known to Git using `` argument. (`--git-only`)
3. **Using a custom finder instance**, which you can provide via a separate PHP file (`--finder-config`).

### Fixing

[](#fixing)

To automatically apply fixes after scanning, append the `--fix` (or `-f`) option.

Currently, two rules do not support auto-fixing:

- Charset
- MaxLineLength

You get a notice for this in result output, when such issues occur.

If an indentation issue is detected but no `indent_size` is defined, a notice is shown, since fixing indentation requires a defined size.

CLI
---

[](#cli)

### Argument

[](#argument)

One or more file names or patterns to check. Wildcards allowed. Default: `['*']`

With this you can only scan certain file types, e.g.

```
$ vendor/bin/ec "*.json" "*.yml" "*.yaml"

```

This also works, when `--git-only` mode is used. Then, all files known to Git are filtered. This is especially useful when applying `--strict` mode only to certain file types such as JSON or YAML.

#### Wildcard Expansion Notice

[](#wildcard-expansion-notice)

Shells like Bash, Zsh, and PowerShell may expand wildcards (`*`) before the tool receives them, passing the list of matching files instead of the literal pattern.

To pass a literal `*`, quote or escape it (e.g. `"*.json"` or `\*.json`).

Use `-v` (verbose) to see the actual arguments received by the EditorConfigCLI.

### Options

[](#options)

The `ec` binary supports the following options:

OptionShortcutDescription`--dir``-d`Define the directory to scan. By default, the current working directory is used.`--exclude``-e`Directories to exclude from scan. Multiple and comma-separated values are allowed.`--disable-auto-exclude``-a`Disables automatic exclusion of files listed in the root `.gitignore` file (if present).`--git-only``-g`Ignores all excludes and scans for all files known to Git. Requires git binary to be present.`--git-only-cmd`Allows you to modify the git command (incl. binary) to get file list. Default: `git ls-files``--finder-config`Allows to define a PHP file providing a custom Finder instance. [Read more](docs/CustomFinderInstance.md)`--skip``-s`Disables rules by name. Multiple and comma-separated values are allowed. See [rules list](#rules-list) below.`--strict`When set, given indention size is forced during scan and fixing. This might conflict with more detailed indention rules, checked by other linters and style-fixers in your project.`--compact``-c`Shows only the files containing issues, not the issues themselves.`--uncovered``-u`Lists all files which are not covered by .editorconfig.`--verbose``-v`Shows additional information, like detailed info about internal time tracking and which binary files have been skipped.`--no-interaction``-n`Skips the confirmation prompt when more than 500 files are found and proceeds immediately. Always returns error code `3`, when not confirming.`--no-error-on-exit`By default `ec` returns code 2 when issues or code 1 when warnings occurred. When enabled, the exit code is always `0`.**Tip:** The "usage" section on `ec`'s help page shows some examples.

### Rules list

[](#rules-list)

The following rules are being executed by default and could get disabled using the `--skip` (`-s`) option:

- `charset`
- `end_of_line`
- `indent_size`
- `indent_style`
- `tab_width`
- `insert_final_newline`
- `max_line_length`
- `trim_trailing_whitespace`

Support and Contribution
------------------------

[](#support-and-contribution)

For questions, issues, or feature requests, please visit the [issue tracker](https://github.com/a-r-m-i-n/editorconfig-cli/issues) on Github.

If you like this project, you are welcome to support its development with [a donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2DCCULSKFRZFU)to support further development. Thank you!

In case you want to contribute code, checkout the [Contribution guide](docs/Contribute.md) for developers.

Changelog
---------

[](#changelog)

[See here](docs/Versions.md)

###  Health Score

58

—

FairBetter than 98% of packages

Maintenance67

Regular maintenance activity

Popularity49

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 96% 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 ~60 days

Recently: every ~124 days

Total

30

Last Release

170d ago

Major Versions

1.x-dev → 2.0.02023-12-28

PHP version history (4 changes)1.0.0PHP ^7.4 | ^8.0

1.1.0PHP ^7.3 | ^8.0

1.8.1PHP ^7.4 || ^8.0

2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/355aa463a532a530009c06219f83ab8b20a9b80a2bc8995064b6d390c6427735?d=identicon)[ArminVieweg](/maintainers/ArminVieweg)

---

Top Contributors

[![a-r-m-i-n](https://avatars.githubusercontent.com/u/1275298?v=4)](https://github.com/a-r-m-i-n "a-r-m-i-n (170 commits)")[![eliashaeussler](https://avatars.githubusercontent.com/u/16313625?v=4)](https://github.com/eliashaeussler "eliashaeussler (7 commits)")

---

Tags

clicontinues-integrationeceditorconfigeditorconfig-checkereditorconfig-clieditorconfig-declarationspharphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/armin-editorconfig-cli/health.svg)

```
[![Health](https://phpackages.com/badges/armin-editorconfig-cli/health.svg)](https://phpackages.com/packages/armin-editorconfig-cli)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[humbug/php-scoper

Prefixes all PHP namespaces in a file or directory.

7963.0M35](/packages/humbug-php-scoper)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)

PHPackages © 2026

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