armin/editorconfig-cli
PHP CLI tool (ec) to validate and auto-fix project files against your .editorconfig rules. Enforce consistent formatting in local workflows and CI: EOL, final newline, trailing whitespace, indentation (tabs/spaces, size), plus checks for charset and max line length.
Start by installing the package as a dev dependency:
composer req --dev armin/editorconfig-cli
Then run the tool against your project root to scan for EditorConfig violations:
vendor/bin/ec
For quick validation and auto-fixing:
vendor/bin/ec --fix
Your first place to look is the project’s .editorconfig file — ensure it’s well-defined (e.g., specifies indent_size, indent_style, end_of_line, etc.). The binary name is ec, so aliased usage like ec --help is common for daily use.
vendor/bin/ec --fix as a pre-commit hook (e.g., via husky + lint-staged) or in GitHub Actions/GitLab CI (vendor/bin/ec --compact for concise reports).--dir to restrict checks to specific file types (e.g., vendor/bin.ec "*.php" "*.twig") or exclude dev-only paths with --exclude=".ddev,.php-cs-fixer.cache".vendor/bin/ec --git-only to limit checks to tracked files only — speeds up execution and avoids linting generated/ignored files.vendor/bin/ec --skip indent_size,max_line_length) during migrations or for legacy files.--finder-config="config/finder.php" (see docs/CustomFinderInstance.md).--strict enforces exact indent_size, which may conflict with tools like PHP-CS-Fixer that use nested indentation rules. Use only when all tools align on indentation rules.* before CLI receives it. Quote patterns ("*.json") to ensure correct behavior. Enable -v to debug actual arguments.SVG or JSON may still be excluded if detected as binary. Use -v to see skipped files; toggle --disable-auto-exclude only if necessary.indent_size is omitted in .editorconfig, fixes for indentation will not be applied — only warnings appear. Always declare indent_size.charset and max_line_length are checked only — no auto-fix is available. Use linters (e.g., phpcodesniffer) for line-length enforcement.1 (warnings), 2 (issues), 3 (no user confirmation in non-interactive mode). Use --no-error-on-exit in CI for reporting-only runs.composer global require armin/editorconfig-cli && alias ec='~/.composer/vendor/bin/ec'.How can I help you explore Laravel packages today?