laravel-webrtc/rust
Blax Software 4d79aee2cc feat: initial laravel-webrtc scaffold on the reactphp-kernel
WebRTC for Laravel on blax-software/reactphp-kernel. PHP owns signaling +
orchestration; a pluggable MediaEngine owns real-time media, with the production
engine backed by a Rust core (str0m via ext-php-rs) so PHP never runs per-20ms DSP.

- WebRtcServiceProvider + config/webrtc.php + webrtc:serve command
- Contracts\MediaEngine (offer/ice/record/connect/bridge/close)
- Media\NullMediaEngine (signaling-only) + Media\Str0mMediaEngine (Rust seam)
- Signaling\SignalingHandler (transport-agnostic) + Server\SignalingServer (on the kernel)
- rust/ crate stub (blax_webrtc: str0m + ext-php-rs) documenting the media plan

Enables: server-side record/intercept, provider-hidden AI-realtime bridging,
and party-to-party/group calls. rel learn-atc #1055 #1051 #1019

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 13:07:59 +02:00
..
src feat: initial laravel-webrtc scaffold on the reactphp-kernel 2026-07-07 13:07:59 +02:00
Cargo.toml feat: initial laravel-webrtc scaffold on the reactphp-kernel 2026-07-07 13:07:59 +02:00
README.md feat: initial laravel-webrtc scaffold on the reactphp-kernel 2026-07-07 13:07:59 +02:00

README.md

blax_webrtc — Rust media core

The timing-critical WebRTC media path for blax-software/laravel-webrtc, so that PHP never runs per-20ms real-time DSP.

Why Rust here

Handling connections concurrently in PHP is a solved problem (Swoole, FrankenPHP, ReactPHP). What is not proven is sustained per-packet media DSP (decrypt SRTP + Opus + RTP jitter every 20ms) glitch-free in single-threaded PHP. That work belongs in a language built for it. str0m is sans-IO (no threads or async of its own — you feed it bytes), which makes it ideal to embed and drive from PHP.

  • str0m owns ICE / DTLS / SRTP / RTP / Opus.
  • ext-php-rs exposes a thin function surface to PHP.
  • PHP (Str0mMediaEngine) forwards SDP/ICE/control across the FFI boundary and calls back into Laravel for persistence (recordings, transmission rows).

Build

# one-time: cargo + the ext-php-rs helper
cargo install cargo-php

cd rust
cargo php install --release   # compiles the cdylib, installs it as the `blax_webrtc` extension
php -m | grep blax_webrtc      # verify it loaded

Then set WEBRTC_MEDIA_ENGINE=BlaxSoftware\LaravelWebRtc\Media\Str0mMediaEngine.

Status

Scaffold. src/lib.rs documents the intended FFI functions (blax_webrtc_offer, ..._add_ice_candidate, ..._start_recording, ..._connect_peers, ..._bridge, ..._close) that Str0mMediaEngine forwards to. Implement them against str0m's RTP/Frame API, then flip the PHP engine off NullMediaEngine.