THE PROJECT

Rebuilding PHP from observable behavior.

phpr does not translate the Zend Engine line by line. It reimplements the language and runtime in Rust, using PHP 8.5.7 as a compatibility oracle.

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.

phpr architecture: PHP source, mago parser, AST/HIR, bytecode and VM.

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.

Current maturity

phpr is an experimental project moving quickly. Much of the core language works, but several extensions and SAPI surfaces are unavailable. It is not currently a recommended replacement for PHP in production.

Read the full status and limitations →

Primary source: technical repository README ↗