Star RestPHP
Already starred? Check a public GitHub username below. This is not a GitHub login; only the username is remembered on this browser.
Appearance
Already starred? Check a public GitHub username below. This is not a GitHub login; only the username is remembered on this browser.
RestPHP combines the raw speed and memory safety of Rust with the ubiquity and flexibility of the PHP Zend Engine.
src/ffi/) RestPHP directly interfaces with libphp.so using Rust's extern "C" declarations:
build.rs and php-config.src/sapi/ and c/sapi.c) Standard PHP communicates with web servers through Server Application Programming Interfaces (SAPIs). RestPHP registers a dedicated restphp SAPI:
ub_write: Intercepts echo, print, and raw HTML, streaming output directly into Rust byte buffers without hitting standard OS stdout.send_headers: Intercepts HTTP response codes and headers set by PHP header().read_post: Streams inbound HTTP POST/PUT bodies iteratively in chunks into PHP's request reader.read_cookies: Supplies raw HTTP cookie strings to Zend's internal parser.src/server.rs) WorkerJob envelopes dispatched across lock-free channels.src/worker.rs) --workers must be 1. Horizontal scaling uses separate supervised processes.php_request_startup() -> script -> php_request_shutdown() for each HTTP request.