PHPackages                             cyberdeep/laravel-agora-token-generator - 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. [Image &amp; Media](/categories/media)
4. /
5. cyberdeep/laravel-agora-token-generator

ActiveLibrary[Image &amp; Media](/categories/media)

cyberdeep/laravel-agora-token-generator
=======================================

Laravel package for generating Agora.io tokens (RTC, RTM, Chat) with support for both V1 and V2 token formats

v1.0.1(10mo ago)0660—0%MITPHPPHP ^8.0

Since Jul 5Pushed 10mo agoCompare

[ Source](https://github.com/Deepankar1993/laravel-agora-token-generator)[ Packagist](https://packagist.org/packages/cyberdeep/laravel-agora-token-generator)[ Docs](https://github.com/cyberdeep/laravel-agora-token-generator)[ GitHub Sponsors](https://github.com/3x1io)[ RSS](/packages/cyberdeep-laravel-agora-token-generator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Laravel Agora Token Generator
=============================

[](#laravel-agora-token-generator)

Agora Token Generator With easy to use Service Class for Laravel applications. This package supports both Agora V1 and V2 token generation, including V2 tokens that start with "007".

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

[](#requirements)

- PHP 8.0.2 or higher
- Laravel 8.x, 9.x, 10.x, 11.x, or 12.x

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

[](#installation)

### From Packagist

[](#from-packagist)

```
composer require cyberdeep/laravel-agora-token-generator:^1.0
```

If you encounter stability issues, you can explicitly allow dev stability:

```
composer require cyberdeep/laravel-agora-token-generator:^1.0 --with-all-dependencies
```

### Local Installation

[](#local-installation)

For instructions on how to install this package locally during development, please see [LOCAL\_INSTALLATION.md](LOCAL_INSTALLATION.md).

Configuration
-------------

[](#configuration)

After installing the package, publish the configuration file:

```
php artisan vendor:publish --tag=laravel-agora-token-generator-config
```

Then, add your Agora credentials to your `.env` file:

```
AGORA_APP_ID=your-app-id
AGORA_APP_CERTIFICATE=your-app-certificate
AGORA_TOKEN_BUILDER=v1  # Use 'v1' for RtcTokenBuilder or 'v2' for RtcTokenBuilder2 (generates tokens starting with 007)

```

Usage
-----

[](#usage)

### Programmatic Usage

[](#programmatic-usage)

```
use CyberDeep\LaravelAgoraTokenGenerator\Services\Agora;

// Generate a token for a publisher
$token = Agora::make($userId)
    ->channel('channel-name')
    ->uId('user-id')
    ->join(false) // false for publisher, true for subscriber
    ->audioOnly(false) // false for video+audio, true for audio only
    ->token();
```

The token generation method will use either V1 or V2 based on your configuration setting (`AGORA_TOKEN_BUILDER`).

### Console Command

[](#console-command)

You can also generate tokens directly from the command line:

```
php artisan agora:generate-token channel-name user-id
```

Options:

- `--join`: Generate a token for a subscriber (audience) instead of a publisher (host)
- `--audio-only`: Generate a token for audio-only mode

For more detailed examples and usage instructions, see [examples/generate\_token.md](examples/generate_token.md).

### Standalone Token Generator

[](#standalone-token-generator)

If you need to generate tokens without Laravel integration, you can use the standalone token generator:

```
php standalone_token_generator.php     [--join] [--audio-only] [--v2]
```

The `--v2` flag enables Agora V2 token generation, which produces tokens that start with "007".

For more information about the standalone token generator, see [standalone\_token\_generator.md](standalone_token_generator.md).

Token Versions
--------------

[](#token-versions)

This package supports two versions of Agora tokens:

### V1 Tokens

[](#v1-tokens)

- Generated using the `RtcTokenBuilder` class
- Default token version if not specified
- Set `AGORA_TOKEN_BUILDER=v1` in your `.env` file

### V2 Tokens

[](#v2-tokens)

- Generated using the `RtcTokenBuilder2` class
- Tokens start with "007"
- Provides enhanced security and features
- Set `AGORA_TOKEN_BUILDER=v2` in your `.env` file

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security
--------

[](#security)

Please see [SECURITY](SECURITY.md) for more information about security.

Credits
-------

[](#credits)

- [Fady Mondy](mailto:info@3x1.io)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance54

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% 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 ~0 days

Total

2

Last Release

317d ago

### Community

Maintainers

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

---

Top Contributors

[![Deepankar1993](https://avatars.githubusercontent.com/u/1295862?v=4)](https://github.com/Deepankar1993 "Deepankar1993 (8 commits)")[![fadymondy](https://avatars.githubusercontent.com/u/11937812?v=4)](https://github.com/fadymondy "fadymondy (5 commits)")[![Jatinkabariya](https://avatars.githubusercontent.com/u/50148784?v=4)](https://github.com/Jatinkabariya "Jatinkabariya (1 commits)")

---

Tags

laraveltokenreal-timeaudiovideochatWebRTCagorartmrtcAgora.io

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cyberdeep-laravel-agora-token-generator/health.svg)

```
[![Health](https://phpackages.com/badges/cyberdeep-laravel-agora-token-generator/health.svg)](https://phpackages.com/packages/cyberdeep-laravel-agora-token-generator)
```

###  Alternatives

[vimeo/laravel

A Vimeo bridge for Laravel

4161.5M4](/packages/vimeo-laravel)[folour/flavy

FFmpeg layer for Laravel 5.2-5.4, this is a fork of rafasamp/sonus package

279.6k](/packages/folour-flavy)[synchro/laravel-medialibrary-audio

Audio file thumbnail generator for Spatie's Laravel Media Library

292.4k](/packages/synchro-laravel-medialibrary-audio)

PHPackages © 2026

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