Guides
PHPRegex reports where you already work. Pick one surface below; each guide installs only the package for that integration and shows its exact configuration, findings, and limits. If you want to compare the packages first, start with Choose a package.
Static analysis
PHPStan
Reports regex patterns your target PHP refuses and, on demand, lint, ReDoS, and optimization findings during static analysis.
Psalm
Types $matches from the pattern and reports invalid patterns for the PHP version your project targets.
Rector
Rewrites a preg_* call into a cheaper string function only when the automata prove the two behave alike.
Testing
PHPUnit
Four assertions for your test suite: what a pattern captures with exact capture semantics, that the running engine compiles it, and that it is proven linear.
Infection
Mutation testing for your regexes: the Infection mutators rewrite the pattern literals of preg_*() calls in small ways, drop every rewrite a mathematical comparison shows behaves exactly like the original, and, when they can build one, give you the test input that tells a remaining rewrite apart.
Applications
Laravel
Adds the Regex service and facade plus Artisan commands for linting, routes, explanations, comparisons, and transpilation.
Symfony
Adds the bundle, php_regex.regex service, and console commands for linting, routes, security analysis, comparisons, and transpilation.
Editors and terminal
Language server
Diagnostics, hover explanations, completion, and quick fixes for PHP files in any editor that speaks the Language Server Protocol.
MCP server
Validation, explanations, layout, translation and ReDoS verdicts served to a coding agent over the Model Context Protocol: Claude Code, Claude Desktop, Cursor, Zed, VS Code.
CLI
One binary for parsing, validation, explanations, diagrams, linting, ReDoS analysis, pattern comparison, and transpilation.
Deep dives
- ReDoS guide: verdicts, guarantees, confirmed mode, and fixes.
- Formatting patterns: lay a long pattern out over lines, or compact it to one, without changing what it matches.
- Regex in PHP: how PCRE behaves inside
preg_*.