PHP CS Fixer

CLI tool that automatically fixes PHP code to follow coding standards

Tool
Composer
vv3.95.19
13,545stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
95/100Excellent
Development Activity100
Maintenance96
Community84
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
85/100Excellent
Architecture88
Code Quality92
Innovation78
Learning Curve80

PHP CS Fixer is a command-line tool that doesn’t just detect PHP coding-standards violations like a linter — it rewrites the code to fix them. It ships built-in rule sets for widely used standards (PHP-FIG’s PER Coding Style, the Symfony coding standard, and its own opinionated @PhpCsFixer set), plus migration rule sets that help modernize a codebase toward newer PHP and PHPUnit syntax.

Teams typically run it via Composer (composer require --dev friendsofphp/php-cs-fixer) and invoke it as php-cs-fixer fix to auto-format a codebase, or php-cs-fixer check in CI to fail a build on style drift, with a project-level configuration file for defining custom rule combinations beyond the built-in sets.

What You Get

  • A php-cs-fixer CLI with fix (rewrite files) and check (report-only, CI-friendly) commands
  • Built-in rule sets for PER Coding Style, Symfony’s coding standard, and the tool’s own opinionated @PhpCsFixer set
  • Auto-migration rule sets (@autoPHPMigration, @autoPHPUnitMigration:risky) that modernize syntax toward newer PHP/PHPUnit versions
  • A configuration-file system (.php-cs-fixer.php/dist.php) for composing custom rule combinations and per-project overrides
  • A custom_rules extension point for teams that need style rules the built-in fixer set doesn’t cover

Common Use Cases

  • Enforcing a consistent code style across a team automatically, instead of relying on manual review comments for formatting nits
  • Gating pull requests in CI with php-cs-fixer check --dry-run, failing the build if any file doesn’t match the configured rule set
  • Migrating a legacy codebase’s syntax toward a newer PHP version’s idioms in bulk via the auto-migration rule sets
  • Adopting a well-known standard (PER-CS, Symfony) on a new project in one command instead of hand-writing a style guide

Under The Hood

Architecture The tool centers on src/Tokenizer (a custom PHP token stream abstraction), src/Fixer (hundreds of individual fixer classes, each implementing one style rule against that token stream), src/RuleSet (named collections of fixers, e.g. @Symfony/@PER-CS), src/Runner and src/Differ (applying fixers across a fileset and computing diffs), src/Cache (incremental-run caching keyed by file hash and ruleset), and src/Console (the CLI command layer wrapping all of the above into fix/check); src/Linter cross-checks fixer output against PHP’s own syntax validity.

Tech Stack It’s a PHP 7.4–8.5 Composer package with symfony/console powering its CLI, its own token-stream/AST-adjacent tooling for source manipulation rather than relying on an external PHP parser, and a Docker-based (Dockerfile/compose.yaml) workflow supporting containerized usage in CI; box.json.dist indicates it’s also distributed as a self-contained PHAR via php-cs-fixer/shim for dependency-conflict-free installs.

Code Quality The repository has an exceptionally large test suite (1,200+ test files) covering essentially every individual fixer plus integration tests, PHPStan static analysis (phpstan.dist.neon) and Infection mutation testing (infection.json5.dist) configured for the CI pipeline, and a composer-dependency-analyser.php check — reflecting the discipline expected of a tool that itself enforces coding standards for thousands of downstream projects. Repo health score of 95/100 reflects very active, well-maintained, rapidly growing development.

API Design The CLI surface is deliberately small (init, fix, check) with rule-set selection doing most of the configuration work, so adopting a standard is typically a one-line config change, while the fixer/rule-set architecture is fully extensible for teams that need custom rules beyond the built-ins.

Used by 10 apps in this directory

PHP
63%
Other

BillaBear

Ecommerce · Invoicing Finance

754

Self-hostable subscription management and billing platform with Stripe integration, tax automation, configurable workflows, and Twig-based document generation.

View details
47
Repo Health
66
Technical
66
Dependency
Built with
PHP63%
Vue18%
Gherkin13%
Updated 2 months ago
PHP
48%
AGPL 3.0

Crater

Invoicing Finance

8,341

Open source invoicing and billing platform for freelancers and small businesses — create estimates, track expenses, accept Stripe payments, and run recurring invoices from your own server.

View details
54
Repo Health
68
Technical
69
Dependency
Built with
PHP48%
Vue40%
Updated 2 years ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,761

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
67
Dependency
Built with
TypeScript75%
Updated today
TypeScript
72%
AGPL 3.0

Firecrawl

AI Development · Developer Tools

169,311

Turn any website into clean, LLM-ready data with a single API call — no proxy headaches, no scraping complexity.

View details
89
Repo Health
83
Technical
66
Dependency
Built with
TypeScript72%
Python14%
Updated today
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,008

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
97
Repo Health
83
Technical
62
Dependency
Built with
PHP85%
XSLT10%
Updated 2 days ago
PHP
86%
AGPL 3.0

Kimai

Invoicing Finance · Project Management

4,918

Professional open-source time tracking with invoicing, multi-user support, SAML/LDAP auth, and a full REST API—self-host it or use the cloud.

View details
94
Repo Health
78
Technical
63
Dependency
Built with
PHP86%
Updated today
PHP
82%
Other

Mautic

Automation · Marketing · Ecommerce

10,366

The world's largest open source marketing automation platform — own your data, run multi-channel campaigns, and escape vendor lock-in forever.

View details
98
Repo Health
76
Technical
64
Dependency
Built with
PHP82%
Updated yesterday
PHP
57%
AGPL 3.0

Nextcloud Server

Collaboration · File Storage

36,474

Your own private cloud: self-hosted file sync, collaboration, and communication with no vendor lock-in.

View details
95
Repo Health
77
Technical
82
Dependency
Built with
PHP57%
JavaScript33%
Updated today
Rust
49%
MIT

Svix

Developer Tools · Automation

3,359

Open source, self-hostable webhook infrastructure that handles delivery, retries, HMAC signing, and multi-tenant event management so you never have to build a webhooks system from scratch.

View details
91
Repo Health
77
Technical
70
Dependency
Built with
Rust49%
C#15%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search