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

ActiveLibrary[API Development](/categories/api)

agence104/livekit-server-sdk
============================

Server-side SDK for LiveKit.

1.3.5(2mo ago)79189.9k↑21.9%43[4 issues](https://github.com/agence104/livekit-server-sdk-php/issues)1MITPHPPHP ^8.1CI passing

Since Jun 8Pushed 2mo ago3 watchersCompare

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

READMEChangelog (10)Dependencies (14)Versions (16)Used By (1)

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

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

Use this SDK to interact with [livekit](https://github.com/livekit/livekit-server) server APIs and create access tokens from your PHP Backend.

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

[](#installation)

### Requirements

[](#requirements)

- php: &gt;= 8.1

### 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\_URL
- 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)

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

```
lando create-test-room

```

#### Step 4:

[](#step-4)

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

```
lando start-test-users

```

#### Step 5:

[](#step-5)

Time to get busy testing.

```
lando test

```

#### Step 6:

[](#step-6)

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.

LiveKit EcosystemLiveKit SDKs[Browser](https://github.com/livekit/client-sdk-js) · [iOS/macOS/visionOS](https://github.com/livekit/client-sdk-swift) · [Android](https://github.com/livekit/client-sdk-android) · [Flutter](https://github.com/livekit/client-sdk-flutter) · [React Native](https://github.com/livekit/client-sdk-react-native) · [Rust](https://github.com/livekit/rust-sdks) · [Node.js](https://github.com/livekit/node-sdks) · [Python](https://github.com/livekit/python-sdks) · [Unity](https://github.com/livekit/client-sdk-unity) · [Unity (WebGL)](https://github.com/livekit/client-sdk-unity-web)Server APIs[Node.js](https://github.com/livekit/node-sdks) · [Golang](https://github.com/livekit/server-sdk-go) · [Ruby](https://github.com/livekit/server-sdk-ruby) · [Java/Kotlin](https://github.com/livekit/server-sdk-kotlin) · [Python](https://github.com/livekit/python-sdks) · [Rust](https://github.com/livekit/rust-sdks) · **PHP (community)** · [.NET (community)](https://github.com/pabloFuente/livekit-server-sdk-dotnet)UI Components[React](https://github.com/livekit/components-js) · [Android Compose](https://github.com/livekit/components-android) · [SwiftUI](https://github.com/livekit/components-swift)Agents Frameworks[Python](https://github.com/livekit/agents) · [Node.js](https://github.com/livekit/agents-js) · [Playground](https://github.com/livekit/agent-playground)Services[LiveKit server](https://github.com/livekit/livekit) · [Egress](https://github.com/livekit/egress) · [Ingress](https://github.com/livekit/ingress) · [SIP](https://github.com/livekit/sip)Resources[Docs](https://docs.livekit.io) · [Example apps](https://github.com/livekit-examples) · [Cloud](https://livekit.io/cloud) · [Self-hosting](https://docs.livekit.io/home/self-hosting/deployment) · [CLI](https://github.com/livekit/livekit-cli)

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance85

Actively maintained with recent releases

Popularity52

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 91% 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 ~114 days

Recently: every ~34 days

Total

13

Last Release

69d ago

PHP version history (2 changes)1.0.0PHP ^8.0

1.3.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![p-delorme](https://avatars.githubusercontent.com/u/104777874?v=4)](https://github.com/p-delorme "p-delorme (122 commits)")[![BafS](https://avatars.githubusercontent.com/u/588205?v=4)](https://github.com/BafS "BafS (3 commits)")[![AngadSethi](https://avatars.githubusercontent.com/u/58678541?v=4)](https://github.com/AngadSethi "AngadSethi (2 commits)")[![kevin-ta](https://avatars.githubusercontent.com/u/9029335?v=4)](https://github.com/kevin-ta "kevin-ta (1 commits)")[![nith-lifestylerx](https://avatars.githubusercontent.com/u/153234517?v=4)](https://github.com/nith-lifestylerx "nith-lifestylerx (1 commits)")[![peter-tharwat](https://avatars.githubusercontent.com/u/30664569?v=4)](https://github.com/peter-tharwat "peter-tharwat (1 commits)")[![AayushN01](https://avatars.githubusercontent.com/u/25500477?v=4)](https://github.com/AayushN01 "AayushN01 (1 commits)")[![shakaran](https://avatars.githubusercontent.com/u/14254?v=4)](https://github.com/shakaran "shakaran (1 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)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[saloonphp/saloon

Build beautiful API integrations and SDKs with Saloon

2.4k9.6M468](/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

265103.1M454](/packages/google-gax)[googleads/googleads-php-lib

Google Ad Manager SOAP API Client Library for PHP

67410.3M25](/packages/googleads-googleads-php-lib)[hubspot/api-client

Hubspot API client

23914.2M16](/packages/hubspot-api-client)

PHPackages © 2026

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