Phasis

Pure PHP JavaScript engine. Lexes, parses, and executes ECMAScript in pure PHP — no Node.js, no FFI, no extensions beyond mbstring.

Pure PHP

No exec(), no FFI, no extensions beyond ext-mbstring. Runs anywhere PHP 8.2+ runs, including hardened hosting and shared environments.

99.97% test262

50,490 of 50,506 official ECMAScript conformance tests pass. The remaining 16 are SpiderMonkey JS-loop stress fixtures that need a bytecode JIT.

Modern ECMAScript

Arrow functions, classes, async/await, Promises, generators, Symbol, BigInt, Proxy, Reflect, Temporal, Intl, TypedArray — full ES2024+ surface.

Direct PHP↔JS Interop

Share PHP objects with JS without serialization. Bind PHP closures as JS functions; mutate PHP arrays from JS. Zero-copy bridging.

Embeddable Engine

One Engine class: eval(), execFile(), setGlobal(), call(). Drop a JS runtime into any PHP app, framework, or CLI tool.

Sandboxable

Resource limits for call depth, loop iterations, string length, console output, and wall-clock execution. The host controls the runtime.

CLI Toolkit

bin/phasis runs files, evaluates expressions, and ships a REPL. bin/test262 measures spec compliance against the official suite.

Oracle-Tested

Every change is verified against Node.js (V8). Compliance is measured continuously against the test262 suite in a 73-shard CI matrix.

Run JavaScript inside PHP.

Install the Composer package and execute your first JS file from PHP in seconds.

Read the Docs