NetherNet transport for PHP
The WebRTC transport used by Minecraft: Bedrock Edition
NetherNet only handles the transport: signaling, identity, framing and connection lifecycle. Packets and gameplay belong to the server.
- PHP 8.1+ with OpenSSL
- ext-rtc built for the running PHP (ZTS for Amber)
$transport = new Transport($config, $identityHandler, $listener,
static fn() => new ExtRtcPeer($config, 20000, 20127, $bindAddress));- Port range
20000, 20127gives each player its own UDP port. - One port for everyone with
udpMux: trueandbegin === end. On Windows it needs an explicit bind address. - Behind port forwarding pass
advertisedAddress: 'public ip', or'ip:public-port:local-port'when the forwarded port differs. A list of entries is accepted. - STUN pass
stunServer: 'host:port'to gather a public candidate. An unreachable server delays gathering past the default signaling timeout. - Behind a TCP proxy pass
trustedProxies: ['10.0.0.5', '172.16.0.0/12']toHttpServer. Connections from those addresses must start with a PROXY protocol v1 or v2 header, and the player address comes from it. - HTTPS pass
tls: new TlsConfig($certificateFile, $privateKeyFile)toHttpServer. TLS 1.2 and 1.3 are accepted on the same port as plain HTTP,required: truerefuses plain HTTP, and the files are read on every handshake so renewals need no restart. Connection::send()returningACCEPTEDmeans local admission, not delivery.Connection::getStats()returns RTT and byte counters while open.
composer check
php -d extension=/path/to/rtc.so vendor/bin/phpunit -c phpunit.rtc.xml.distWithout ext-rtc use composer install --ignore-platform-req=ext-rtc for the fake backend tests. ExtWebRtcPeer remains as a legacy backend; never load ext-rtc and ext-webrtc together.