PHPackages                             homedoctor-es/opentok-laravel - 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. homedoctor-es/opentok-laravel

ActiveLibrary[API Development](/categories/api)

homedoctor-es/opentok-laravel
=============================

A laravel bundle for the OpenTok PHP SDK

v3.0.0(2y ago)03.1k↓40%1MITPHPPHP ^7.2|^8.0

Since May 1Pushed 2y agoCompare

[ Source](https://github.com/homedoctor-es/opentok-laravel)[ Packagist](https://packagist.org/packages/homedoctor-es/opentok-laravel)[ Docs](https://github.com/homedoctor-es/opentok-laravel)[ RSS](/packages/homedoctor-es-opentok-laravel/feed)WikiDiscussions master Synced 1mo ago

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

OpenTok for Laravel
===================

[](#opentok-for-laravel)

This is a Laravel 8 wrapper library for the [OpenTok](http://tokbox.com/opentok/) SDK. OpenTok is a product by TokBox which utilizes WebRTC to enable peer to peer video, audio and messaging. Please note: this repository is in *NO WAY* associated with TokBox.

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

[](#installation)

To get the latest version of OpenTok Laravel, simply require the project using [Composer](https://getcomposer.org):

```
$ composer homedoctor-es/opentok-laravel
```

Instead, you may of course manually update your require block and run `composer update` if you so choose:

```
{
	"require": {
		"homedoctor-es/opentok-laravel": "^2.0"
	}
}
```

Once OpenTok Laravel is installed, you need to register the service provider. Open up `config/app.php` and add the following to the `providers` key.

- `HomedoctorEs\OpentokLaravel\ServiceProvider::class`

You can register the OpentokApi facade in the `aliases` key of your `config/app.php` file if you like.

- `'OpentokApi' => HomedoctorEs\OpentokLaravel\Facades\OpentokApi::class`

### Configuration

[](#configuration)

The defaults are set in `config/cors.php'. Copy this file to your own config directory to modify the values. You can publish the config using this command:

```
php artisan vendor:publish --provider="HomedoctorEs\OpentokLaravel\ServiceProvider"

```

Get your api\_key and api\_secret from your OpenTok account and replace the placeholders in your config file.

### Before you dive in...

[](#before-you-dive-in)

Although it's very tempting to dive straight in, to avoid frustration, I would highly recommend that you take a look at the [Intro to OpenTok](http://tokbox.com/opentok/intro/) and also click around the site and read their docs. My documentation is *terrible* and only intended to make it easier to use for laravel developers and in no way is it a replacement for the OpenTok documentation (which is really good).

It's definitely a good idea to get to grips with the general flow, the technologies used and also their definitions e.g. session, publisher, subscriber, token etc.

### General Usage

[](#general-usage)

First you need to create a session so your subscribers and/or publishers have something to associate with

```
// new session
$session    = OpentokApi::createSession();
$sessionId  = $session->getSessionId();

// check if it's been created or not (could have failed)
if (empty($sessionId)) {
    throw new \Exception("An open tok session could not be created");
}
```

Now we need to create a token for your publisher to use so they can actually publish Please note that you will need to API key on the client side to use in the JS so something like this would be fine: (saves you hardcoding in your JS file or template)

```
// use the necessary files
use HomedoctorEs\OpentokLaravel\Facades\OpentokApi;
use OpenTok\Role;
use OpenTokException;

// get your API key from config
$api_key = Config::get('opentok.api_key');

// then create a token (session created in previous step)
try {
    // note we're create a publisher token here, for subscriber tokens we would specify.. yep 'subscriber' instead
    $token = OpentokApi::generateToken($sessionId,
        array(
            'role' => Role::PUBLISHER
        )
    );
} catch(OpenTokException $e) {
    // do something here for failure
}

// pass these to your view where you're broadcasting from as you'll need them...
return View::make('your/view')
    ->with('session_id', $sessionId)
    ->with('api_key', $api_key)
    ->with('token', $token)
```

For the JS/HTML etc. for publishing video/audio/messages please see the OpenTok [Quick Start Guide](http://tokbox.com/opentok/quick-start/) and [Documentation](http://tokbox.com/opentok/libraries/client/js/) and take a browse around their How To examples etc. they're pretty good!

Hopefully you will find this library useful, if so please feel free to let me know, and feel free to drop any comments, questions or suggestions to improve!

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 57.9% 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 ~449 days

Recently: every ~636 days

Total

9

Last Release

802d ago

Major Versions

1.1.5 → 2.02022-01-11

2.0 → v3.0.02024-03-01

PHP version history (3 changes)v1.0.0PHP &gt;=5.3.0

v1.1.0PHP &gt;=5.4.0

v3.0.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13337359?v=4)[Homedoctor](/maintainers/Homedoctor)[@HomeDoctor](https://github.com/HomeDoctor)

---

Top Contributors

[![tomcorbett](https://avatars.githubusercontent.com/u/5196373?v=4)](https://github.com/tomcorbett "tomcorbett (11 commits)")[![jlorente](https://avatars.githubusercontent.com/u/301741?v=4)](https://github.com/jlorente "jlorente (3 commits)")[![Hypnopompia](https://avatars.githubusercontent.com/u/673731?v=4)](https://github.com/Hypnopompia "Hypnopompia (2 commits)")[![dldean](https://avatars.githubusercontent.com/u/1613480?v=4)](https://github.com/dldean "dldean (1 commits)")[![dzeroone](https://avatars.githubusercontent.com/u/5366980?v=4)](https://github.com/dzeroone "dzeroone (1 commits)")[![r4y7s](https://avatars.githubusercontent.com/u/6150209?v=4)](https://github.com/r4y7s "r4y7s (1 commits)")

---

Tags

streamingOpenTokvideo streaming

### Embed Badge

![Health badge](/badges/homedoctor-es-opentok-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/homedoctor-es-opentok-laravel/health.svg)](https://phpackages.com/packages/homedoctor-es-opentok-laravel)
```

###  Alternatives

[duncan3dc/sonos

Control Sonos speakers using a simple API

10915.1k1](/packages/duncan3dc-sonos)[jwplayer/jwplatform

Official JW Player client

18384.5k](/packages/jwplayer-jwplatform)[redwebcreation/twitter-stream-api

Consume the Twitter Stream API in real-time.

3220.3k1](/packages/redwebcreation-twitter-stream-api)

PHPackages © 2026

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