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

ActiveLibrary[API Development](/categories/api)

cumulati/opentok-laravel
========================

A laravel bundle for the OpenTok PHP SDK

1.3.0(6y ago)14001MITPHPPHP &gt;=5.4.0

Since Aug 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/cumulati/opentok-laravel)[ Packagist](https://packagist.org/packages/cumulati/opentok-laravel)[ Docs](https://github.com/cumulati/opentok-laravel)[ RSS](/packages/cumulati-opentok-laravel/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (12)Used By (0)

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

[](#opentok-for-laravel)

This is a Laravel 5 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 require mmsccons/opentok-laravel
```

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

```
{
    "require": {
        "mmsccons/opentok-laravel": "dev-master"
    }
}
```

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.

- `OpentokLaravel\ServiceProvider::class`

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

- `'Opentok' => OpentokLaravel\Facades\Opentok::class`

### Configuration

[](#configuration)

The defaults are set in `config/opentok.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="OpentokLaravel\ServiceProvider"

```

Get your api\_key and api\_secret from your OpenTok account and replace the placeholders in your config file. To configure multiple projects, see below.

### Before you dive in...

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

Although it's very tempting to dive straight in, to avoid frustration, I would highly reccomend 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 assiciate with

```
// new session
$session    = Opentok::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 Config;
use Opentok; // Facade
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 = Opentok::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!

### Multiple Projects

[](#multiple-projects)

You may want to define multiple OpenTok projects, for example for Safari 11 support. To add an additional project, add the project settings to the config/opentok.php file.

To reference a project by name:

```
// projectName is as defined in the configuration file.
$session = Opentok::project('projectName')->createSession();

// to access the default project, you can do either
$session = Opentok::project('defaultProjectName')->createSession();
// or..
$session = Opentok::createSession();
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~128 days

Recently: every ~166 days

Total

10

Last Release

2399d ago

Major Versions

v0.0.2 → v1.0.02017-12-22

### Community

Maintainers

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

---

Top Contributors

[![pmccarren](https://avatars.githubusercontent.com/u/4959702?v=4)](https://github.com/pmccarren "pmccarren (15 commits)")[![tomcorbett](https://avatars.githubusercontent.com/u/5196373?v=4)](https://github.com/tomcorbett "tomcorbett (11 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)")

---

Tags

laravelstreamingTokBoxOpenTokvideo streaming

### Embed Badge

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

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

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[api-ecosystem-for-laravel/dingo-api

A RESTful API package for the Laravel and Lumen frameworks.

3121.5M10](/packages/api-ecosystem-for-laravel-dingo-api)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[kirschbaum-development/laravel-openapi-validator

Automatic OpenAPI validation for Laravel HTTP tests

581.1M5](/packages/kirschbaum-development-laravel-openapi-validator)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

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