# Laravel Agora

<figure><img src="/files/4lvuFyEwLYhCmCpipVBq" alt=""><figcaption></figcaption></figure>

### Installation

```
composer require tomatophp/laravel-agora
```

publish config file

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

go to your env and add you can find it from [Project Management](https://console.agora.io/)

```
AGORA_APP_ID=
AGORA_APP_CERTIFICATE=
```

### Using

you can use the class to return your token like

```
Agora::make(id: 1)->uId(rand(999, 1999))->token();
```

it will generate an Audio/Video Token as a Publisher

the channel name will be `agora.USER_ID`

#### Join To Channel

if you went to join an existing channel use this where the id is the user you went to connect with

```
Agora::make(id: 1)->uId(rand(999, 1999))->join()->token();
```

#### Create Audio Only

if you went to an audio channel only use this

```
Agora::make(id: 1)->uId(rand(999, 1999))->join()->audioOnly()->token();
```

#### Custom Channel

you can custom your channel name by use

```
Agora::make(id: 1)->uId(rand(999, 1999))->channel('custom')->token()
```

than your channel will be `custom.USER_ID`

### Changelog

Please see [CHANGELOG](https://github.com/tomatophp/laravel-agora/blob/master/CHANGELOG.md) for more information on what has changed recently.

### Security

Please see [SECURITY](https://github.com/tomatophp/laravel-agora/blob/master/SECURITY.md) for more information about the security.

### Credits

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

### License

The MIT License (MIT). Please see [License File](https://github.com/tomatophp/laravel-agora/blob/master/LICENSE.md) for more information.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tomatophp.com/helpers/laravel-agora.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
