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.

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.

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, 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.

Current maturity

The WordPress compatibility milestone is real: full single-site and multisite suites are at effective oracle parity, and WordPress runs over real MySQL and HTTP. phpr nevertheless remains experimental: many specialist extensions are absent, the persistent-VM boundary is still under validation, and production hardening, security review and packaging are unfinished.

Read the full status and limitations →

Primary sources: technical README ↗ · measured coverage ↗ · current server integration commit ↗