Greph
Pure PHP code search, structural search, and rewrite engine. grep, ripgrep, and ast-grep workflows in a single Composer package.
Pure PHP
No exec(), no FFI, no extensions beyond ext-json. Works everywhere PHP 8.2+ runs, including hardened hosting.
Text Search
Fixed-string and regex search with whole-word, case-insensitive, context, count, and file-only modes. grep-compatible output.
AST Search
Structural PHP search with $VAR and $$$VARIADIC metavariables, repeated captures, and JSON output. Format-agnostic matching.
AST Rewrite
Format-preserving structural rewrites with dry-run, interactive, and write modes. Refactor without losing comments or layout.
Indexed Modes
Warmed trigram text indexes, AST fact indexes, and cached AST search. Order-of-magnitude faster than re-scanning.
rg & sg Wrappers
Drop-in ripgrep and ast-grep compatibility wrappers, probe-verified against the upstream binaries.
Parallel Workers
pcntl-based worker pool with single-process fallback. Scales text and AST scans across all available cores.
Oracle-Tested
Every mode is verified against canonical grep, ripgrep, and ast-grep oracles in a regression corpus that runs in CI.
Ready to search smarter?
Install the Composer package and run your first text or AST search in seconds.
Read the Docs