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(3mo ago)88348.2k↑118.7%47[5 issues](https://github.com/agence104/livekit-server-sdk-php/issues)1MITPHPPHP ^8.1CI passing

Since Jun 8Pushed 3mo 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 3d 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.env` 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)

Run the tests. This single command handles everything automatically: creating a test room, starting load test participants, setting up an RTMP tunnel, running PHPUnit, and cleaning up when done.

```
lando test

```

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) · [ESP32](https://github.com/livekit/client-sdk-esp32)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

59

—

FairBetter than 98% of packages

Maintenance79

Regular maintenance activity

Popularity54

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 91.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

Every ~114 days

Recently: every ~34 days

Total

13

Last Release

116d 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 (124 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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[google/apiclient

Client library for Google APIs

9.8k205.9M1.1k](/packages/google-apiclient)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[google/auth

Google Auth Library for PHP

1.4k294.2M219](/packages/google-auth)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[sylius/sylius

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

8.5k5.9M738](/packages/sylius-sylius)

PHPackages © 2026

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