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.
php-types
Semantics
Zval, strings, arrays, objects, comparison, coercion, streams and shared primitives.
php-runtime
VM
Lowering, compiler, bytecode, OOP, exceptions, GC, PDO and dispatch.
php-builtins
Standard library
Pure functions and host integrations verified against the reference runtime.
php-cli
CLI
The phpr binary with compatible streams, options and exit codes.
phpt-runner
Conformance
Runs the official corpus, isolates tests and reports differences from the oracle.
php-server
Server, evolving
A bridge toward a resident SAPI, preload and standalone delivery; not production-ready.