PHPackages                             sangezar/srs-php-client - 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. [API Development](/categories/api)
4. /
5. sangezar/srs-php-client

ActiveLibrary[API Development](/categories/api)

sangezar/srs-php-client
=======================

PHP client for SRS (Simple Realtime Server) API

v1.0.1(1y ago)03MITPHPPHP ^7.4|^8.0CI passing

Since Feb 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sangezar/srs-php-client)[ Packagist](https://packagist.org/packages/sangezar/srs-php-client)[ RSS](/packages/sangezar-srs-php-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

SRS PHP Client
==============

[](#srs-php-client)

PHP client for interacting with SRS (Simple Realtime Server) API.

[![Latest Version on Packagist](https://camo.githubusercontent.com/5eaf471e7155d0f2d71ac2aa76c32803a0ebc9721e6f2017a12aab1aec4ed67a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616e67657a61722f7372732d7068702d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sangezar/srs-php-client)[![Total Downloads](https://camo.githubusercontent.com/d11768b367feaec310230be58cd67c3d8ba37fb49285ea52ddcb68bf966fd379/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616e67657a61722f7372732d7068702d636c69656e742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sangezar/srs-php-client)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Features
--------

[](#features)

- 🚀 Full SRS API support
- 🔧 Convenient object-oriented interface
- 📝 Typed data and IDE autocompletion
- 📚 Detailed documentation and examples
- 🛡️ Error handling and exceptions
- 🔒 SSL/TLS support
- ⚙️ Flexible configuration

Installation
------------

[](#installation)

```
composer require sangezar/srs-php-client
```

Quick Start
-----------

[](#quick-start)

```
use SrsClient\Client;
use SrsClient\Config;
use SrsClient\Exception\SrsApiException;

try {
    // Create client
    $config = new Config('http://your-srs-server:1985');
    $client = new Client($config);

    // Get list of streams
    $streams = $client->getStreams();
    foreach ($streams as $stream) {
        echo "Stream: " . $stream->getName() . "\n";
        echo "Clients: " . $stream->getClients() . "\n";
        echo "Bitrate: " . $stream->getBitrateKbps() . " Kbps\n";
    }

} catch (SrsApiException $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
```

Documentation
-------------

[](#documentation)

Detailed documentation is available in multiple languages in the [docs](docs) directory:

- [English Documentation](docs/en/index.md)
- [Ukrainian Documentation](docs/ua/index.md)
- [Chinese Documentation](docs/cn/index.md)

Requirements
------------

[](#requirements)

- PHP 7.4 or higher
- Composer
- PHP Extensions:
    - JSON
    - cURL

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Authors
-------

[](#authors)

- [Sangezar](https://github.com/sangezar)

Support
-------

[](#support)

If you encounter any issues or have suggestions for improvements, please:

1. Check [existing issues](https://github.com/sangezar/srs-php-client/issues)
2. Create a new issue with a detailed description
3. Submit a pull request with fixes or improvements

Changelog
---------

[](#changelog)

All notable changes are documented in the [CHANGELOG.md](CHANGELOG.md) file.

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use SrsClient\Client;
use SrsClient\Config;

// Create configuration with credentials
$config = new Config('http://your-srs-server:1985', [
    'credentials' => [
        'username' => 'admin',
        'password' => 'password'
    ],
    'timeout' => 5,
    'verify' => true,
    'debug' => false
]);

// Initialize client
$client = new Client($config);

// Get SRS version
$version = $client->getVersions();
echo "Version: " . $version->getVersion() . "\n";
echo "Server ID: " . $version->getServerId() . "\n";
echo "Service ID: " . $version->getServiceId() . "\n";

// Check version
if ($version->isNewerThan('5.0.0')) {
    echo "Running on newer version than 5.0.0\n";
}

// Working with streams
$streams = $client->getStreams();
$streamInfo = $client->getStream('stream-id');
$client->deleteStream('stream-id');

// Working with clients
$clients = $client->getClients(20); // get 20 clients
$clientInfo = $client->getClient('client-id');
$client->deleteClient('client-id');
```

### Available Settings

[](#available-settings)

Configuration supports the following options:

- `credentials` - Authentication credentials:
    - `username` - Username
    - `password` - Password
- `timeout` - Request timeout in seconds (default: 30)
- `verify` - SSL certificate verification (true/false or path to CA bundle)
- `proxy` - Proxy settings
- `debug` - Debug mode (true/false)
- `headers` - Additional HTTP headers

### Available Methods

[](#available-methods)

#### System Information

[](#system-information)

- `getVersions()` - Get SRS version
    - Returns `Version` object with methods:
        - `getVersion()` - Full version (e.g., "5.0.213")
        - `getServerId()` - Unique server ID
        - `getServiceId()` - Unique service ID
        - `getPid()` - Process ID
        - `getMajor()` - Major version
        - `getMinor()` - Minor version
        - `getRevision()` - Revision
        - `isVersion(string $version)` - Check specific version
        - `isNewerThan(string $version)` - Check if version is newer
        - `isOlderThan(string $version)` - Check if version is older
- `getSummaries()` - Get general information (pid, argv, pwd, cpu, mem)
- `getRusages()` - Get resource usage statistics
- `getSelfProcStats()` - Get SRS process statistics
- `getSystemProcStats()` - Get system process statistics
- `getMeminfos()` - Get system memory information
- `getPerformance()` - Get system performance statistics

#### Server Information

[](#server-information)

- `getAuthors()` - Get information about authors, license, and contributors
- `getFeatures()` - Get list of supported features
- `getRequests()` - Get current request information
- `getRawConfig()` - Get RAW SRS configuration

#### Virtual Host Management

[](#virtual-host-management)

- `getVhosts()` - Get list of all virtual hosts
- `getVhost(string $vhost)` - Get information about specific virtual host

#### Stream Management

[](#stream-management)

- `getStreams()` - Get list of all streams
- `getStream(string $streamId)` - Get information about specific stream
- `deleteStream(string $streamId)` - Delete stream

#### Client Management

[](#client-management)

- `getClients(int $count = 10)` - Get list of clients (default 10)
- `getClient(string $clientId)` - Get information about specific client
- `deleteClient(string $clientId)` - Delete client

#### Cluster and Diagnostics

[](#cluster-and-diagnostics)

- `getClusters()` - Cluster management
- `getTcmalloc(string $page = 'summary')` - Get tcmalloc information

### Error Handling

[](#error-handling)

```
use SrsClient\Exception\SrsApiException;

try {
    $streams = $client->getStreams();
} catch (SrsApiException $e) {
    echo "Error: " . $e->getMessage();
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance42

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

470d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb89dcb20d9283445d8658502698bea1e3bc3e87b740371926a1114d9beb29fa?d=identicon)[sangezar](/maintainers/sangezar)

---

Tags

streamingapi clientsrtsrsrtmprtmp-serverrtmp-clientrtmp-streaming

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sangezar-srs-php-client/health.svg)

```
[![Health](https://phpackages.com/badges/sangezar-srs-php-client/health.svg)](https://phpackages.com/packages/sangezar-srs-php-client)
```

###  Alternatives

[crowdin/crowdin-api-client

PHP client library for Crowdin API v2

611.5M5](/packages/crowdin-crowdin-api-client)[pili-engineering/pili-sdk-php.v2

Pili Streaming Cloud Server-Side Library For PHP.

4665.4k](/packages/pili-engineering-pili-sdk-phpv2)[pili-engineering/pili-sdk-php

Pili Streaming Cloud server-side library for PHP.

735.4k1](/packages/pili-engineering-pili-sdk-php)[jobapis/jobs-common

Making it simple to integrate your application with job api providers.

4459.3k32](/packages/jobapis-jobs-common)[fabian-beiner/todoist-php-api-library

A PHP client library that provides a native interface to the official Todoist REST API.

4810.8k](/packages/fabian-beiner-todoist-php-api-library)[mrt1m/playstation-store-api

A simple wrapper for working with PlayStation Store API

734.2k](/packages/mrt1m-playstation-store-api)

PHPackages © 2026

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