Skip to content

Rewrite your app in Rust, piece by piece, checked against the original at every step. Works with TypeScript, JavaScript, Python, Go, Ruby, Java, C, PHP, C#, Kotlin, PowerShell and Swift.

1.4 KB
Raw Blame

title: PHP description: Bridge PHP functions and supported static methods to Rust, or record and replay a PHP CLI or server.

PHP

Unit a file or folder of top-level functions or supported final classes
Bridge a JSON dispatcher over ext-ffi
Today Unit bridges and whole apps. Use app record, app replay and the front door for CLIs and servers (php -S).
Status Verified on PEAR XML_Util 1.4.5 behind a facade: 1,838/1,838, gate passes; no shadow, no --batch, no profile

analyze plans a PHP app: Composer packages and PSR-4 autoloading, risks such as loose comparison and integer overflow into floats, and Composer packages mapped to crates. Types come from PHP types and phpdoc.

A PHP CLI or server can be recorded, replayed and put behind a Rust front door:

rust-anything app record . -- php cli.php
rust-anything app record . --http -- php -S 127.0.0.1:{port} router.php
rust-anything app replay .
rust-anything app front-door .

Top-level functions with scalar, string, list and assoc-array parameters bridge through PHP's FFI. Supported final classes can also bridge their public static methods. Functions using objects, references, variadics, callables or generators stay in PHP with the reason.

CI installs PHP only on macOS, so the PHP tests run in CI there and skip on Linux and Windows.