Skip to main content

Module bridge

Module bridge 

Source
Expand description

Shared memory bridge — bidirectional PHP ↔ JSC communication.

§PHP → JSC (bext_render)

PHP: $html = bext_render(“Dashboard”, ‘{“orders”:42}’) → C FFI → Rust → JSC pool → HTML → PHP

§JS → PHP (php_call)

JS: const data = bext.php(“GET”, “/api/products”, ‘{“category”:“Books”}’) → Rust → PHP worker pool → JSON → JS

Both directions use the same process memory — no HTTP, no sockets.

Structs§

PhpCallResult
Result of a JS→PHP call.

Traits§

JscBridge
Trait abstracting the JSC render pool so bext-php doesn’t depend on bext-core.
PhpBridge
Trait abstracting the PHP pool so JSC/Bun can call PHP.

Functions§

has_jsc_bridge
Check if a JSC bridge is available.
has_php_bridge
Check if a PHP bridge is available.
jsc_render
Render via the JSC bridge. Called from the C SAPI’s bext_render() function.
jsc_render_component
Render a named component via the JSC bridge.
php_call
Call PHP from JS. Returns (status, body, content_type).
set_jsc_bridge
Register the JSC pool for PHP threads to use. Called once at server startup after the JSC pool is initialized.
set_php_bridge
Register the PHP pool for JS threads to use.