THE IDEA
Preserve the contract, not the technical inheritance.
PHP's historical core is a large, battle-tested C system shaped by decades of compatibility and architectural choices. phpr starts from another question: what contract must an alternative runtime actually preserve?
The answer is observable output: values, coercions, warnings, exceptions, side effects and stack traces. The official .phpt corpus makes that contract executable and comparable.
The oracle is always right.
When documentation, intuition and actual behavior disagree, the project measures PHP 8.5.7 and reproduces what really happens.
PIPELINE
From a PHP file to the VM.
Production uses a single engine: a bytecode VM. The mago parser builds syntax, the runtime lowers it to HIR, compiles bytecode and executes it in an explicit dispatch loop.
The engine itself is reimplemented from scratch. Selected extension surfaces deliberately use narrow FFI bindings to the same system libraries as the reference build—such as libgd, libxslt, libtidy and zlib—when that is the most faithful path to byte parity.
php-types
Semantics
Zval, strings, arrays, objects, comparison, coercion, streams and shared primitives.
php-runtime
VM
Lowering, compiler, bytecode, OOP, exceptions, cycle GC, databases and dispatch.
php-builtins
Standard library
Value functions and host integrations verified against the reference runtime.
php-cli
CLI and SAPI
The phpr binary, compatible options and the validated phpr -S server path.
phpt-runner
Conformance
Runs the official corpus, isolates tests and reports differences from the oracle by name.
php-server
Axum worker path
An Axum server and dedicated-thread worker pool are under integration. A persistent RetainSet now lives at worker scope and the explicit lifecycle is wired; each request still creates a fresh VM.