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)9881MITPHP

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 4w 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 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

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

2725d 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

43.5k344.8k1](/packages/ccxt-ccxt)[composer/composer

Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.

29.5k199.6M3.4k](/packages/composer-composer)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[rector/rector-src

Instant Upgrade and Automated Refactoring of any PHP code

136411.0k14](/packages/rector-rector-src)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k17.3k100](/packages/elgg-elgg)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k20](/packages/tempest-framework)

PHPackages © 2026

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