PHPackages                             phpbg/rtsp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. phpbg/rtsp

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

phpbg/rtsp
==========

Basic RTSP 1.0 server built on top of react

0.3.1(7y ago)9871MITPHP

Since Dec 1Pushed 7y ago1 watchersCompare

[ Source](https://github.com/phpbg/rtsp)[ Packagist](https://packagist.org/packages/phpbg/rtsp)[ RSS](/packages/phpbg-rtsp/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

Pure PHP RTSP 1.0 server
========================

[](#pure-php-rtsp-10-server)

This is a library that allow you to build a [RTSP/1.0](https://www.ietf.org/rfc/rfc2326.txt) server.

Examples
========

[](#examples)

Bare minimum server
-------------------

[](#bare-minimum-server)

This is a very minimal server that will

- dump requests
- reply with 200 OK (which is not very useful :-)):

```
require __DIR__ . '/vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

//Normal port is 554 but we use 5540 instead to avoid root required
$socket = new \React\Socket\TcpServer('tcp://0.0.0.0:5540', $loop);

$server = new \PhpBg\Rtsp\Server(function (\PhpBg\Rtsp\Message\Request $request, \React\Socket\ConnectionInterface $connection) {
    echo $request;
    $response = \PhpBg\Rtsp\Message\MessageFactory::response();
    $response->setHeader('cseq', $request->getHeader('cseq'));
    return $response;
});

$server->on('error', function (\Exception $e) {
    echo $e->getMessage() . "\r\n";
    echo $e->getTraceAsString() . "\r\n";
});

$server->listen($socket);
echo "Server started\r\n";
echo "Open any decent video player (e.g. vlc, mpv) and open rtsp://localhost:5540\r\n";
$loop->run();
```

Server with middleware stack
----------------------------

[](#server-with-middleware-stack)

This is almost the same example as the previous one, but with a more flexible and trendy middleware stack.

`phpbg/rtsp` comes with some handy middlewares that will help you build a rfc compliant application:

- `AutoCseq`: automatically add cseq header to your responses
- `AutoContentLength`: automatically add content-length to your responses
- `Log`: Automatically log request and responses

```
require __DIR__ . '/../vendor/autoload.php';

$loop = React\EventLoop\Factory::create();

//Normal port is 554 but we use 5540 instead to avoid root required
$socket = new \React\Socket\TcpServer('tcp://0.0.0.0:5540', $loop);

$middlewares = [
    new \PhpBg\Rtsp\Middleware\Log(),
    new \PhpBg\Rtsp\Middleware\AutoCseq(),
    new \PhpBg\Rtsp\Middleware\AutoContentLength(),
    function (\PhpBg\Rtsp\Message\Request $request, \React\Socket\ConnectionInterface $connection) {
        // 200 OK response middleware
        return \PhpBg\Rtsp\Message\MessageFactory::response();
    }
];

$server = new \PhpBg\Rtsp\Server(new \PhpBg\Rtsp\Middleware\MiddlewareStack($middlewares));

$server->on('error', function (\Exception $e) {
    echo $e->getMessage() . "\r\n";
    echo $e->getTraceAsString() . "\r\n";
});

$server->listen($socket);
echo "Server started\r\n";
echo "Open any decent video player (e.g. vlc, mpv) and open rtsp://localhost:5540\r\n";
$loop->run();
```

Install
=======

[](#install)

```
composer require phpbg/rtsp

```

Contribute
==========

[](#contribute)

Tests
-----

[](#tests)

To run unit tests launch:

```
php vendor/phpunit/phpunit/phpunit --coverage-text -c phpunit.xml

```

NB: launching with code coverage increase greatly the time required for tests to run, especially memory leak searching tests

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Total

5

Last Release

2680d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1350d8c1326e5a10ff142b33e9d7ad6363acc427900a9a581cc9fa76329c31b0?d=identicon)[Samuel CHEMLA](/maintainers/Samuel%20CHEMLA)

---

Top Contributors

[![phpbg](https://avatars.githubusercontent.com/u/43315561?v=4)](https://github.com/phpbg "phpbg (9 commits)")

---

Tags

serverreactrtsp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phpbg-rtsp/health.svg)

```
[![Health](https://phpackages.com/badges/phpbg-rtsp/health.svg)](https://phpackages.com/packages/phpbg-rtsp)
```

###  Alternatives

[ccxt/ccxt

A cryptocurrency trading API with more than 100 exchanges in JavaScript / TypeScript / Python / C# / PHP / Go

42.9k337.6k1](/packages/ccxt-ccxt)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[php-mcp/server

PHP SDK for building Model Context Protocol (MCP) servers - Create MCP tools, resources, and prompts

849482.3k47](/packages/php-mcp-server)[voryx/thruway

Thruway WAMP router core

6751.0M17](/packages/voryx-thruway)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136400.8k14](/packages/rector-rector-src)[phpfastcgi/fastcgi-daemon

A FastCGI daemon written in PHP

33011.4k4](/packages/phpfastcgi-fastcgi-daemon)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
