composer php - Loading OpenTok libraries on Codeigniter -
i have been trying load opentok php sdk in codeigniter. there no actual repository of codeigniter opentok. tried add opentok folder directly libraries folder , called $this->load->library('opentok');
didn't help.
currently, using in core php.
require "vendor/autoload.php"; use opentok\opentok; use opentok\mediamode; use opentok\archivemode; use opentok\session; use opentok\role;
the library opentok composer package. question how call in codeigniter. opentok developer here had used opentok in codeigniter?
appreciate help.thanks
in config/config.php:
$config['composer_autoload'] = true;
your composer.json file needs inside application directory. it's going this:
{ "name": "nsqdev/project", "description": "nsq dev project", "type": "application", "license": "proprietary", "authors": [ { "name": "nsq dev", "email": "nsqdev@nsqdev.com" } ], "minimum-stability": "dev", "require": { "opentok/opentok": "3.0.*" } }
use composer commands location (/application), "composer install".
now, in controller, model, or wherever want run opentok:
use opentok\opentok; $opentok = new opentok($apikey, $apisecret);
hope helps. composer.json file may not perfect, may want or need change version of opentok. otherwise, composer usage in codeigniter pretty easy, , gives access lots of packages.
more info:
as @tpojka states, use require command line. details usage available in composer documentation: https://getcomposer.org/doc/03-cli.md#require
for general basic usage of composer, start here: https://getcomposer.org/doc/01-basic-usage.md
wiki
Comments
Post a Comment