PHPackages                             bakhadyrovf/livekit-server-sdk - 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. bakhadyrovf/livekit-server-sdk

ActiveLibrary[API Development](/categories/api)

bakhadyrovf/livekit-server-sdk
==============================

Server-side SDK for LiveKit.

1.0.0(2y ago)020MITPHPPHP ^8.0

Since Apr 22Pushed 2y agoCompare

[ Source](https://github.com/BakhadyrovF/livekit-server-sdk-php)[ Packagist](https://packagist.org/packages/bakhadyrovf/livekit-server-sdk)[ RSS](/packages/bakhadyrovf-livekit-server-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

LiveKit Server API for PHP
==========================

[](#livekit-server-api-for-php)

PHP APIs to manage rooms and to create access tokens. This library is designed to work with [livekit-server](https://github.com/livekit/livekit-server). Use it with a PHP backend to manage access to LiveKit.

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

[](#installation)

### Requirements

[](#requirements)

- php: &gt;= 8

### Composer

[](#composer)

```
composer require agence104/livekit-server-sdk

```

Usage
-----

[](#usage)

### Environment Variables

[](#environment-variables)

You may store credentials in environment variables. If host, api-key or api-secret is not passed in when creating a RoomServiceClient or AccessToken, the values in the following env vars will be used:

- LIVEKIT\_HOST
- LIVEKIT\_API\_KEY
- LIVEKIT\_API\_SECRET

### Creating Access Tokens

[](#creating-access-tokens)

Creating a token for participant to join a room.

```
use Agence104\LiveKit\AccessToken;
use Agence104\LiveKit\AccessTokenOptions;
use Agence104\LiveKit\VideoGrant;

// If this room doesn't exist, it'll be automatically created when the first
// client joins.
$roomName = 'name-of-room';
// The identifier to be used for participant.
$participantName = 'user-name';

// Define the token options.
$tokenOptions = (new AccessTokenOptions())
  ->setIdentity($participantName);

// Define the video grants.
$videoGrant = (new VideoGrant())
  ->setRoomJoin();
  ->setRoomName($roomName);

// Initialize and fetch the JWT Token.
$token = (new AccessToken('api-key', 'secret-key'))
  ->init($tokenOptions)
  ->setGrant($videoGrant)
  ->toJwt();
```

By default, the token expires after 6 hours. you may override this by passing in `ttl` in the access token options. `ttl` is expressed in seconds (as number) .

### Parsing the Access Tokens

[](#parsing-the-access-tokens)

Converting the JWT Token into a ClaimGrants.

```
use Agence104\LiveKit\AccessToken;

// Initialize and parse the JWT Token.
$claimGrants = (new AccessToken('api-key', 'secret-key'))
  ->fromJwt($token);
```

### Permissions in Access Tokens

[](#permissions-in-access-tokens)

It's possible to customize the permissions of each participant:

```
use Agence104\LiveKit\VideoGrant;

$videoGrant = (new VideoGrant())
  ->setRoomJoin() // TRUE by default.
  ->setRoomName('name-of-room')
  ->setCanPublish(FALSE)
  ->setCanSubscribe() // TRUE by default.
  ->setGrant($videoGrant);
```

This will allow the participant to subscribe to tracks, but not publish their own to the room.

### Managing Rooms

[](#managing-rooms)

`RoomServiceClient` gives you APIs to list, create, and delete rooms. It also requires a pair of api key/secret key to operate.

```
use Agence104\LiveKit\RoomServiceClient;
use Agence104\LiveKit\RoomCreateOptions;

$host = 'https://my.livekit.host';
$svc = new RoomServiceClient($host, 'api-key', 'secret-key');

// List rooms.
$rooms = $svc->listRooms();

// Create a new room.
$opts = (new RoomCreateOptions())
  ->setName('myroom')
  ->setEmptyTimeout(10)
  ->setMaxParticipants(20);
$room = $svc->createRoom($opts);

// Delete a room.
$svc->deleteRoom('myroom');
```

### Running Tests

[](#running-tests)

We'll utilize Lando to streamline the test execution process. However, should you choose to run the tests on your local environment directly, you can certainly proceed with that approach.

#### Step 1:

[](#step-1)

Generate your environment file by duplicating `example.dev` and renaming the copy to `.env`, then enter your credentials accordingly.

### Step 2:

[](#step-2)

Start the lando project.

```
lando start

```

#### Step 3:

[](#step-3)

Set up a LiveKit project with the livekit-cli by executing the command below, which will prompt you to provide some API credentials.

```
lando create-project

```

#### Step 4:

[](#step-4)

Generate the LiveKit room that will serve as the testing environment for the majority of the test cases.

```
lando create-test-room

```

#### Step 5:

[](#step-5)

Initialize 5 test users within the room. Run this command in a separate terminal window.

```
lando start-test-users

```

#### Step 6:

[](#step-6)

Time to get busy testing.

```
lando test

```

#### Step 7:

[](#step-7)

Once tests are completed, it is time to clean up.

- End the `lando start-test-users` command.
- Run `lando delete-test-room` to delete the test room.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.2% 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

Unknown

Total

1

Last Release

747d ago

### Community

Maintainers

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

---

Top Contributors

[![p-delorme](https://avatars.githubusercontent.com/u/104777874?v=4)](https://github.com/p-delorme "p-delorme (55 commits)")[![BakhadyrovF](https://avatars.githubusercontent.com/u/95900968?v=4)](https://github.com/BakhadyrovF "BakhadyrovF (3 commits)")[![ashwin-nath-m](https://avatars.githubusercontent.com/u/50395482?v=4)](https://github.com/ashwin-nath-m "ashwin-nath-m (1 commits)")[![Corneel-D](https://avatars.githubusercontent.com/u/4570115?v=4)](https://github.com/Corneel-D "Corneel-D (1 commits)")[![shakaran](https://avatars.githubusercontent.com/u/14254?v=4)](https://github.com/shakaran "shakaran (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bakhadyrovf-livekit-server-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/bakhadyrovf-livekit-server-sdk/health.svg)](https://phpackages.com/packages/bakhadyrovf-livekit-server-sdk)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M647](/packages/sylius-sylius)[agence104/livekit-server-sdk

Server-side SDK for LiveKit.

79189.9k1](/packages/agence104-livekit-server-sdk)[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M467](/packages/saloonphp-saloon)[irazasyed/telegram-bot-sdk

The Unofficial Telegram Bot API PHP SDK

3.3k4.5M84](/packages/irazasyed-telegram-bot-sdk)[google/gax

Google API Core for PHP

263103.1M452](/packages/google-gax)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)

PHPackages © 2026

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