Search by

danog / php-rtc-stun

danog

STUN transactions and NAT discovery for PHP, ported to Amp v3 sockets and fibers. MadelineProto's PHP 8.2+ fork supports the modular danog/php-rtc stack.

Package info

github.com/danog/php-rtc-stun

pkg:composer/danog/php-rtc-stun

Fund package maintenance!

php-webrtc

Statistics

Installs: 1 863

Dependents: 3

Suggesters: 0

Stars: 0

Open Issues: 0

2.0.7 2026-09-06 22:04 UTC

README

PHP Version License

A PHP library for STUN (Session Traversal Utilities for NAT) protocol, enabling NAT discovery and reflexive address retrieval for ICE connectivity in WebRTC applications.

About this fork

This is the danog/php-rtc-stun fork used by MadelineProto. It targets PHP 8.2+ and replaces ReactPHP with Amp v3 UDP sockets, blocking fiber APIs, and Revolt retransmission timers. Receive handlers run in separate fibers to avoid deadlocks, and socket addresses remain Amp\Socket\InternetAddress objects throughout the library.

All internal Composer dependencies use their danog/php-rtc-* package names directly, so installing a component selects the maintained danog packages throughout the dependency graph.

Features

  • Encode and decode STUN messages
  • Support for Binding requests and responses
  • Implements STUN message integrity and fingerprinting
  • Compatible with ICE and TURN components

Requirements

  • PHP ≥ 8.2

Address API

All socket endpoints passed to or returned by the library use Amp\Socket\InternetAddress. This includes local and remote transport addresses, STUN request destinations, response source addresses, receiver callbacks, and address-valued STUN message attributes. Strings and [host, port] arrays are not accepted as socket endpoints.

Documentation

This package is part of the PHP WebRTC library. For complete documentation, examples, and API reference, visit:

PHP WebRTC Documentation

Credits

Authors

Reporting Issues

Found a bug? Please report it on our issues.

License

BSD 3-Clause License. See LICENSE for details.

References