Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Editorconfig Cli Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • CI Integration: Add 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).
  • Selective Scanning: Use wildcards or --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".
  • Git-Only Mode: In CI or large repos, use vendor/bin/ec --git-only to limit checks to tracked files only — speeds up execution and avoids linting generated/ignored files.
  • Rule Skipping: Temporarily bypass problematic rules (e.g., vendor/bin/ec --skip indent_size,max_line_length) during migrations or for legacy files.
  • Custom Finder: For advanced inclusion/exclusion (e.g., include dotfiles, exclude vendor/*), define a PHP finder script and pass via --finder-config="config/finder.php" (see docs/CustomFinderInstance.md).

Gotchas and Tips

  • Strict Mode Pitfall: --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.
  • Wildcard Handling: Shells may expand * before CLI receives it. Quote patterns ("*.json") to ensure correct behavior. Enable -v to debug actual arguments.
  • Binary Files: Though fixed in v1.7+, some files like SVG or JSON may still be excluded if detected as binary. Use -v to see skipped files; toggle --disable-auto-exclude only if necessary.
  • Missing Indentation Size: If indent_size is omitted in .editorconfig, fixes for indentation will not be applied — only warnings appear. Always declare indent_size.
  • Non-Fixable Rules: charset and max_line_length are checked only — no auto-fix is available. Use linters (e.g., phpcodesniffer) for line-length enforcement.
  • Exit Codes Matter: Default exit codes: 1 (warnings), 2 (issues), 3 (no user confirmation in non-interactive mode). Use --no-error-on-exit in CI for reporting-only runs.
  • Global Installs: Ideal for multi-project reuse: composer global require armin/editorconfig-cli && alias ec='~/.composer/vendor/bin/ec'.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4