Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

PHP-CS-Fixer

$ php-cs-fixer Community Low Risk
Symfony / FriendsOfPHP · Code & DevOps · MIT · macos / linux / windows

Standard PHP coding-standards fixer enforcing PSR-12, Symfony, and PER Coding Style rules across PHP repositories. Supports non-destructive --dry-run --diff previews and structured --format=json output.

FCRS-1.0 Score
82 /100
Good
Medium Confidence
Zero-Friction Install
brew install php-cs-fixer
CLI vs MCP Decision CLI Only

Formats local PHP repositories directly; CLI execution is simple and offline.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
✓ Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Supports --dry-run, --diff, --format=json, --stop-on-violation, and clear exit codes.

  • --dry-run --diff --format=json gives structured JSON diff reports
Trust & Safety 22 / 25

Blocks risky rules unless --allow-risky=yes is passed, though fix mutates files unless --dry-run is specified.

  • Separates risky fixers behind --allow-risky=yes
  • Requires --dry-run because fix is the primary subcommand
Setup & Portability 11 / 15

Requires a PHP runtime (brew install php-cs-fixer or Composer friendsofphp/php-cs-fixer).

  • Depends on compatible host PHP version
Utility & Efficiency 12 / 15

Canonical PHP style fixer with parallel runner and .php-cs-fixer.cache speedup.

  • Supports PSR-12, PER-CS, and Symfony presets
Maintenance & Lineage 8 / 10

Widely adopted community/Symfony-ecosystem project (PHP-CS-Fixer/PHP-CS-Fixer) under MIT license.

  • Maintained at PHP-CS-Fixer/PHP-CS-Fixer
Docs & Verifiability 8 / 10

Well-maintained documentation for CLI options, rules, and config at cs.symfony.com.

  • Official docs at cs.symfony.com/doc/usage.html

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

Offline local PHP formatter; no credentials stored or required.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source PHP tool; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# PHP-CS-Fixer Agent Rules
- Always pass `--dry-run --diff --format=json` before running `php-cs-fixer fix` without `--dry-run`.
- Respect the repo's `.php-cs-fixer.dist.php` config and avoid `--allow-risky=yes` unless explicitly requested.

Agent-Ready Command Recipes

Safe Read-Only Queries

Dry-run PHP formatting check as JSON
php-cs-fixer fix --dry-run --diff --format=json src/

Reports files needing fixes plus diffs in JSON and exits non-zero without editing files.

Controlled Writes & Previews

Fix PHP coding standards on targeted path
php-cs-fixer fix --format=json src/Controller/

Applies configured PSR-12/Symfony fixes in place to src/Controller/.

Strengths for Agents

  • + --dry-run --diff --format=json combines safe read-only preview with structured JSON diffs.
  • + Explicitly gates semantic-changing rules behind --allow-risky=yes.

Caveats & Pitfalls

  • ! Primary subcommand is fix, so forgetting --dry-run immediately modifies files.
  • ! Requires matching PHP runtime version (may fail on newer PHP syntax until updated).

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI