{"id":19845432,"url":"https://github.com/opentok/opentok-php-sdk","last_synced_at":"2026-01-29T06:22:48.141Z","repository":{"id":1745782,"uuid":"2571715","full_name":"opentok/OpenTok-PHP-SDK","owner":"opentok","description":"OpenTok PHP Server SDK","archived":false,"fork":false,"pushed_at":"2025-03-24T18:39:41.000Z","size":1858,"stargazers_count":141,"open_issues_count":8,"forks_count":143,"subscribers_count":67,"default_branch":"main","last_synced_at":"2025-04-13T01:56:35.219Z","etag":null,"topics":["opentok","php","php-sdk","tokbox"],"latest_commit_sha":null,"homepage":"https://tokbox.com/developer/sdks/php/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opentok.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-10-13T19:13:03.000Z","updated_at":"2025-03-24T18:37:16.000Z","dependencies_parsed_at":"2023-07-05T19:32:36.008Z","dependency_job_id":"2a6c9e45-a779-4387-8f9f-ef3a8f24a90a","html_url":"https://github.com/opentok/OpenTok-PHP-SDK","commit_stats":{"total_commits":520,"total_committers":41,"mean_commits":"12.682926829268293","dds":0.7096153846153845,"last_synced_commit":"3f10580e0fef97d112cee3a57ab53b75abd22874"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2FOpenTok-PHP-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2FOpenTok-PHP-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2FOpenTok-PHP-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opentok%2FOpenTok-PHP-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opentok","download_url":"https://codeload.github.com/opentok/OpenTok-PHP-SDK/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654050,"owners_count":21140235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["opentok","php","php-sdk","tokbox"],"created_at":"2024-11-12T13:07:49.378Z","updated_at":"2026-01-29T06:22:48.082Z","avatar_url":"https://github.com/opentok.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenTok PHP SDK\n\n\u003e## Notice\n\u003e\n\u003e This library is designed to work with the Tokbox/OpenTok platform, part of the Vonage Video API. If you are looking to use the Vonage Video API and using the Vonage Customer Dashboard, you will want to install the\n\u003e [Vonage Server SDK for PHP]((https://github.com/Vonage/vonage-php-sdk-video)), which includes support for the Vonage Video API.\n\u003e\n\u003e Not sure which exact platform you are using? Take a look at [this guide](https://api.support.vonage.com/hc/en-us/articles/10817774782492).\n\u003e\n\u003e If you are using the Tokbox platform, do not worry! The Tokbox platform is not going away, and this library will continue to be updated. While we encourage customers to check out the new Unified platform, there is no rush to  \u003e switch. Both platforms run the exact same infrastructure and capabilities, with the main difference is a unified billing interface and easier access to [Vonage’s other CPaaS APIs](https://www.vonage.com/communications-apis/).\n\u003e\n\u003e If you are new to the Vonage Video API, head on over to the [Vonage Customer Dashboard](https://dashboard.vonage.com) to sign up for a developer account and check out the [Vonage Server SDK for \u003clanguage\u003e](link to core SDK). \n\n[![Build Status](https://travis-ci.org/opentok/OpenTok-PHP-SDK.svg)](https://travis-ci.org/opentok/OpenTok-PHP-SDK) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)\n\n\u003cimg src=\"https://assets.tokbox.com/img/vonage/Vonage_VideoAPI_black.svg\" height=\"48px\" alt=\"Tokbox is now known as Vonage\" /\u003e\n\nThe OpenTok PHP SDK provides methods for:\n\n* Generating\n[sessions](https://tokbox.com/developer/guides/create-session/) and\n[tokens](https://tokbox.com/developer/guides/create-token/) for\n[OpenTok](https://www.tokbox.com/) applications that run on the .NET platform\n* Working with [OpenTok archives](https://tokbox.com/opentok/tutorials/archiving)\n* Working with [OpenTok live streaming broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/)\n* Working with [OpenTok SIP interconnect](https://tokbox.com/developer/guides/sip)\n* [Sending signals to clients connected to a session](https://tokbox.com/developer/guides/signaling/)\n* [Disconnecting clients from sessions](https://tokbox.com/developer/guides/moderation/rest/)\n* [Forcing clients in a session to disconnect or mute published audio](https://tokbox.com/developer/guides/moderation/)\n* Working with OpenTok [Audio Connector](https://tokbox.com/developer/guides/audio-connector)\n\n## Installation\n\n### Composer (recommended):\n\nComposer helps manage dependencies for PHP projects. Find more info here: \u003chttp://getcomposer.org\u003e\n\nAdd this package (`opentok/opentok`) to your `composer.json` file, or run the following at the\ncommand line:\n\n```bash\n$ composer require opentok/opentok ^4.0\n```\n\n## Usage\n\n### Initializing\n\nThis package follows the [PSR-4](http://www.php-fig.org/psr/psr-4/) autoloading standard. If you are\nusing composer to install, you just require the generated autoloader:\n\n```php\nrequire \"\u003cprojectpath\u003e/vendor/autoload.php\";\n```\n\nOnce the files of the SDK are loaded, you initialize an `OpenTok\\OpenTok` object with your own API\nKey and API Secret.\n\n```php\nuse OpenTok\\OpenTok;\n\n$opentok = new OpenTok($apiKey, $apiSecret);\n```\n\n#### Initialization Options\n\nThe `OpenTok\\OpenTok` object just allow for some overrides of values when special needs arise, such as\nneeding to point to a different datacenter or change the timeout of the underlying HTTP client. For\nthese situations, you can pass an array of additional options as the third parameter.\n\nWe allow the following options:\n* `apiUrl` - Change the domain that the SDK points to. Useful when needing to select a specific datacenter\nor point to a mock version of the API for testing\n* `client` - Custom API client that inherits from `OpenTok\\Utils\\Client`, useful for customizing an HTTP client\n* `timeout` - Change the default HTTP timeout, which defaults to forever. You can pass a number of seconds to change the timeout.\n\n```php\nuse OpenTok\\OpenTok;\nuse MyCompany\\CustomOpenTokClient;\n\n$options = [\n    'apiUrl' =\u003e 'https://custom.domain.com/',\n    'client' =\u003e new CustomOpenTokClient(),\n    'timeout' =\u003e 10,\n]\n$opentok = new OpenTok($apiKey, $apiSecret, $options);\n```\n#### Migrating to Vonage Video API\n\nThere is some useful behaviour on initialization in this SDK that will help as a stopgap before switching out from the\nlegacy TokBok API to the new, Vonage Video API. To do this, you can pass in an Application ID for the API Key, and the path to\na Vonage private key as the API Secret.\n\n```php\nuse OpenTok\\OpenTok;\nuse MyCompany\\CustomOpenTokClient;\n\n$applicationID = '61bb2dae-9b69-400c-9abb-642d082af5fc';\n$privateKey = './private.key';\n\n$opentok = new OpenTok($applicationID, $privateKey);\n```\n\nThe SDK will notice that the authentiction has changed, and will automatically start to forward requests to the Vonage API Routes\ninstead of the OpenTok API Routes. All requests and responses in your code should be exactly the same as they are on the\nOpenTok API.\n\n**NOTE:** The SDK will read the private key path from the root directory of your project (generally one level above the docroot\nof your application), so you will need to make sure that the path provided is either absolute, or relative to your project root.\n\n### Creating Sessions\n\nTo create an OpenTok Session, use the `createSession($options)` method of the\n`OpenTok\\OpenTok` class. The `$options` parameter is an optional array used to specify the following:\n\n- Setting whether the session will use the OpenTok Media Router or attempt to send streams directly\n  between clients.\n\n- Setting whether the session will automatically create archives (implies use of routed session)\n\n- Specifying a location hint.\n\nThe `getSessionId()` method of the `OpenTok\\Session` instance returns the session ID,\nwhich you use to identify the session in the OpenTok client libraries.\n\n```php\nuse OpenTok\\MediaMode;\nuse OpenTok\\ArchiveMode;\n\n// Create a session that attempts to use peer-to-peer streaming:\n$session = $opentok-\u003ecreateSession();\n\n// A session that uses the OpenTok Media Router, which is required for archiving:\n$session = $opentok-\u003ecreateSession(array( 'mediaMode' =\u003e MediaMode::ROUTED ));\n\n// A session with a location hint:\n$session = $opentok-\u003ecreateSession(array( 'location' =\u003e '12.34.56.78' ));\n\n// An automatically archived session:\n$sessionOptions = array(\n    'archiveMode' =\u003e ArchiveMode::ALWAYS,\n    'mediaMode' =\u003e MediaMode::ROUTED\n);\n$session = $opentok-\u003ecreateSession($sessionOptions);\n\n\n// Store this sessionId in the database for later use\n$sessionId = $session-\u003egetSessionId();\n```\n\n### Generating Tokens\n\nOnce a Session is created, you can start generating Tokens for clients to use when connecting to it.\nYou can generate a token either by calling the `generateToken($sessionId, $options)` method of the\n`OpenTok\\OpenTok` class, or by calling the `generateToken($options)` method on the `OpenTok\\Session`\ninstance after creating it. The `$options` parameter is an optional array used to set the role,\nexpire time, and connection data of the Token. For layout control in archives and broadcasts,\nthe initial layout class list of streams published from connections using this token can be set as well.\n\n```php\nuse OpenTok\\Session;\nuse OpenTok\\Role;\n\n// Generate a Token from just a sessionId (fetched from a database)\n$token = $opentok-\u003egenerateToken($sessionId);\n// Generate a Token by calling the method on the Session (returned from createSession)\n$token = $session-\u003egenerateToken();\n\n// Set some options in a token\n$token = $session-\u003egenerateToken(array(\n    'role'       =\u003e Role::MODERATOR,\n    'expireTime' =\u003e time()+(7 * 24 * 60 * 60), // in one week\n    'data'       =\u003e 'name=Johnny',\n    'initialLayoutClassList' =\u003e array('focus')\n));\n```\n\n### Working with Streams\n\nYou can get information about a stream by calling the `getStream($sessionId, $streamId)` method of the\n`OpenTok\\OpenTok` class.\n\n```php\nuse OpenTok\\Session;\n\n// Get stream info from just a sessionId (fetched from a database)\n$stream = $opentok-\u003egetStream($sessionId, $streamId);\n\n// Stream properties\n$stream-\u003eid; // string with the stream ID\n$stream-\u003evideoType; // string with the video type\n$stream-\u003ename; // string with the name\n$stream-\u003elayoutClassList; // array with the layout class list\n```\n\nYou can get information about all the streams in a session by calling the `listStreams($sessionId)` method of the\n`OpenTok\\OpenTok` class.\n\n```php\nuse OpenTok\\Session;\n\n// Get list of streams from just a sessionId (fetched from a database)\n$streamList = $opentok-\u003elistStreams($sessionId);\n\n$streamList-\u003etotalCount(); // total count\n```\n\n### Working with Archives\n\nYou can only archive sessions that use the OpenTok Media Router\n(sessions with the media mode set to routed).\n\nYou can start the recording of an OpenTok Session using the `startArchive($sessionId, $name)` method\nof the `OpenTok\\OpenTok` class. This will return an `OpenTok\\Archive` instance. The parameter\n`$archiveOptions` is an optional array and is used to assign a name, whether to record audio and/or\nvideo, the desired output mode for the Archive, and the desired resolution if applicable. Note that you can only start an\nArchive on a Session that has clients connected.\n\n```php\n// Create a simple archive of a session\n$archive = $opentok-\u003estartArchive($sessionId);\n\n\n// Create an archive using custom options\n$archiveOptions = array(\n    'name' =\u003e 'Important Presentation',     // default: null\n    'hasAudio' =\u003e true,                     // default: true\n    'hasVideo' =\u003e true,                     // default: true\n    'outputMode' =\u003e OutputMode::COMPOSED,   // default: OutputMode::COMPOSED\n    'resolution' =\u003e '1280x720'              // default: '640x480'\n);\n$archive = $opentok-\u003estartArchive($sessionId, $archiveOptions);\n\n// Store this archiveId in the database for later use\n$archiveId = $archive-\u003eid;\n```\n\nIf you set the `outputMode` option to `OutputMode::INDIVIDUAL`, it causes each stream in the archive to be recorded to its own individual file. Please note that you cannot specify the resolution when you set the `outputMode` option to `OutputMode::INDIVIDUAL`. The `OutputMode::COMPOSED` setting (the default) causes all streams in the archive to be recorded to a single (composed) file.\n\nNote that you can also create an automatically archived session, by passing in `ArchiveMode::ALWAYS`\nas the `archiveMode` key of the `options` parameter passed into the `OpenTok-\u003ecreateSession()`\nmethod (see \"Creating Sessions,\" above).\n\nYou can stop the recording of a started archive using the `stopArchive($archiveId)` method of the\n`OpenTok\\OpenTok` object. You can also do this using the `stop()` method of the\n`OpenTok\\Archive` instance.\n\n```php\n// Stop an Archive from an archiveId (fetched from database)\n$opentok-\u003estopArchive($archiveId);\n// Stop an Archive from an Archive instance (returned from startArchive)\n$archive-\u003estop();\n```\n\nTo get an `OpenTok\\Archive` instance (and all the information about it) from an archive ID, use the\n`getArchive($archiveId)` method of the `OpenTok\\OpenTok` class.\n\n```php\n$archive = $opentok-\u003egetArchive($archiveId);\n```\n\nTo delete an Archive, you can call the `deleteArchive($archiveId)` method of the `OpenTok\\OpenTok`\nclass or the `delete()` method of an `OpenTok\\Archive` instance.\n\n```php\n// Delete an Archive from an archiveId (fetched from database)\n$opentok-\u003edeleteArchive($archiveId);\n// Delete an Archive from an Archive instance (returned from startArchive, getArchive)\n$archive-\u003edelete();\n```\n\nYou can also get a list of all the Archives you've created (up to 1000) with your API Key. This is\ndone using the `listArchives($offset, $count, $sessionId)` method of the `OpenTok/OpenTok` class. The parameters\n`$offset`, `$count`, and `$sessionId` are optional and can help you paginate through the results, and subset the\ndata by a specific session. This will return an instance of the `OpenTok\\ArchiveList` class.\n\n```php\n$archiveList = $opentok-\u003elistArchives();\n\n// Get an array of OpenTok\\Archive instances\n$archives = $archiveList-\u003egetItems();\n// Get the total number of Archives for this API Key\n$totalCount = $archiveList-\u003etotalCount();\n```\n\nFor composed archives, you can change the layout dynamically, using the `setArchiveLayout($archiveId, $layoutType)` method:\n\n```php\nuse OpenTok\\OpenTok;\n\n$layout = Layout::getPIP(); // Or use another get method of the Layout class.\n$opentok-\u003esetArchiveLayout($archiveId, $layout);\n```\n\nYou can set the initial layout class for a client's streams by setting the `layout` option when\nyou create the token for the client, using the `OpenTok-\u003egenerateToken()` method or the\n`Session-\u003egenerateToken()` method. And you can change the layout classes for a stream\nby calling the `OpenTok-\u003eupdateStream()` method.\n\nSetting the layout of composed archives is optional. By default, composed archives use the\n\"best fit\" layout (see [Customizing the video layout for composed\narchives](https://tokbox.com/developer/guides/archiving/layout-control.html)).\n\nFor more information on archiving, see the\n[OpenTok archiving](https://tokbox.com/developer/guides/archiving/) developer guide.\n\n### Working with Broadcasts\n\nYou can only start live streaming broadcasts for sessions that use the OpenTok Media Router\n(sessions with the media mode set to routed).\n\nStart the live streaming broadcast of an OpenTok Session using the\n`startBroadcast($sessionId, $options)` method of the `OpenTok\\OpenTok` class.\nThis will return an `OpenTok\\Broadcast` instance. The `$options` parameter is\nan array used to define the broadcast streams, assign broadcast options such as layout,\nmaxDuration, resolution, and more.\n\n```php\n// Define options for the broadcast\n$options = [\n  'layout' =\u003e Layout::getBestFit(),\n  'maxDuration' =\u003e 5400,\n  'resolution' =\u003e '1280x720',\n  'output' =\u003e [\n    'hls' =\u003e [\n      'dvr' =\u003e true,\n      'lowLatency' =\u003e false\n    ],\n    'rtmp' =\u003e [\n      [\n        'id' =\u003e 'foo',\n        'serverUrl' =\u003e 'rtmps://myfooserver/myfooapp',\n        'streamName' =\u003e 'myfoostream'\n      ],\n      [\n        'id' =\u003e 'bar',\n        'serverUrl' =\u003e 'rtmps://myfooserver/mybarapp',\n        'streamName' =\u003e 'mybarstream'\n      ],\n    ]\n  ]\n];\n\n// Start a live streaming broadcast of a session\n$broadcast = $opentok-\u003estartBroadcast($sessionId, $options);\n\n// Store the broadcast ID in the database for later use\n$broadcastId = $broadcast-\u003eid;\n```\n\nYou can stop the live streaming broadcast using the `stopBroadcast($broadcastId)` method of the\n`OpenTok\\OpenTok` object. You can also do this using the `stop()` method of the\n`OpenTok\\Broadcast` instance.\n\n```php\n// Stop a broadcast from an broadcast ID (fetched from database)\n$opentok-\u003estopBroadcast($broadcastId);\n\n// Stop a broadcast from an Broadcast instance (returned from startBroadcast)\n$broadcast-\u003estop();\n```\n\nTo get an `OpenTok\\Broadcast` instance (and all the information about it) from a broadcast ID,\nuse the `getBroadcast($broadcastId)` method of the `OpenTok\\OpenTok` class.\n\n```php\n$broadcast = $opentok-\u003egetBroadcast($broadcastId);\n```\n\nYou can set change the layout dynamically, using the\n`OpenTok-\u003eupdateBroadcastLayout($broadcastId, $layout)` method:\n\n```php\nuse OpenTok\\OpenTok;\n\n$layout = Layout::getPIP(); // Or use another get method of the Layout class.\n$opentok-\u003eupdateBroadcastLayout($broadcastId, $layout);\n```\n\nYou can use the `Layout` class to set the layout types:\n`Layout::getHorizontalPresentation()`, `Layout::getVerticalPresentation()`, `Layout::getPIP()`,\n`Layout::getBestFit()`, `Layout::createCustom()`.\n\n```php\n$layoutType = Layout::getHorizontalPresentation();\n$opentok-\u003esetArchiveLayout($archiveId, $layoutType);\n\n// For custom Layouts, you can do the following\n$options = array(\n    'stylesheet' =\u003e 'stream.instructor {position: absolute; width: 100%;  height:50%;}'\n);\n\n$layoutType = Layout::createCustom($options);\n$opentok-\u003esetArchiveLayout($archiveId, $layoutType);\n```\n\nYou can also set the Screenshare Layout by calling the `setScreenshareType()` method on a layout object.\n\n```php\n$layout = Layout::getBestFit(); // Other types are not currently supported\n$layout-\u003esetScreenshareType(Layout::LAYOUT_VERTICAL);\n```\n\nYou can set the initial layout class for a client's streams by setting the `layout` option when\nyou create the token for the client, using the `OpenTok-\u003egenerateToken()` method or the\n`Session-\u003egenerateToken()` method. And you can change the layout classes for a stream\nby calling the `OpenTok-\u003eupdateStream()` method.\n\nSetting the layout of live streaming broadcasts is optional. By default, broadcasts use the\n\"best fit\" layout (see [Configuring video layout for OpenTok live streaming\nbroadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/#configuring-video-layout-for-opentok-live-streaming-broadcasts)).\n\nFor more information on live streaming broadcasts, see the\n[OpenTok live streaming broadcasts](https://tokbox.com/developer/guides/broadcast/live-streaming/)\ndeveloper guide.\n\n### Force a Client to Disconnect\n\nYour application server can disconnect a client from an OpenTok session by calling the `forceDisconnect($sessionId, $connectionId)`\nmethod of the `OpenTok\\OpenTok` class.\n\n```php\nuse OpenTok\\OpenTok;\n\n// Force disconnect a client connection\n$opentok-\u003eforceDisconnect($sessionId, $connectionId);\n```\n\n### Forcing clients in a session mute published audio\n\nYou can force the publisher of a specific stream to stop publishing audio using the \n`Opentok.forceMuteStream($sessionId, $stream)` method.\n\nYou can force the publisher of all streams in a session (except for an optional list of streams)\nto stop publishing audio using the `Opentok.forceMuteAll($sessionId, $excludedStreamIds)` method.\nYou can then disable the mute state of the session by calling the\n`Opentok.DisableForceMute(sessionId)` or `Opentok.DisableForceMuteAsync(sessionId)`\nmethod.\n\n### Sending Signals\n\nOnce a Session is created, you can send signals to everyone in the session or to a specific connection.\nYou can send a signal by calling the `signal($sessionId, $payload, $connectionId)` method of the\n`OpenTok\\OpenTok` class.\n\nThe `$sessionId` parameter is the session ID of the session.\n\nThe `$payload` parameter is an associative array used to set the\nfollowing:\n\n- `data` (string) -- The data string for the signal. You can send a maximum of 8kB.\n\n- `type` (string) -- \u0026mdash; (Optional) The type string for the signal. You can send a maximum of 128 characters, and only the following characters are allowed: A-Z, a-z, numbers (0-9), '-', '\\_', and '~'.\n\nThe `$connectionId` parameter is an optional string used to specify the connection ID of\na client connected to the session. If you specify this value, the signal is sent to\nthe specified client. Otherwise, the signal is sent to all clients connected to the session.\n\n```php\nuse OpenTok\\OpenTok;\n\n// Send a signal to a specific client\n$signalPayload = array(\n    'data' =\u003e 'some signal message',\n    'type' =\u003e 'signal type'\n);\n$connectionId = 'da9cb410-e29b-4c2d-ab9e-fe65bf83fcaf';\n$opentok-\u003esignal($sessionId, $signalPayload, $connectionId);\n\n// Send a signal to everyone in the session\n$signalPayload = array(\n    'data' =\u003e 'some signal message',\n    'type' =\u003e 'signal type'\n);\n$opentok-\u003esignal($sessionId, $signalPayload);\n```\n\nFor more information, see the [OpenTok signaling developer\nguide](https://tokbox.com/developer/guides/signaling/).\n\n### Working with SIP Interconnect\n\nYou can add an audio-only stream from an external third-party SIP gateway using the SIP\nInterconnect feature. This requires a SIP URI, the session ID you wish to add the audio-only\nstream to, and a token to connect to that session ID.\n\nTo initiate a SIP call, call the `dial($sessionId, $token, $sipUri, $options)` method of the\n`OpenTok\\OpenTok` class:\n\n```php\n$sipUri = 'sip:user@sip.partner.com;transport=tls';\n\n$options = array(\n  'headers' =\u003e  array(\n    'X-CUSTOM-HEADER' =\u003e 'headerValue'\n  ),\n  'auth' =\u003e array(\n    'username' =\u003e 'username',\n    'password' =\u003e 'password'\n  ),\n  'secure' =\u003e true,\n  'from' =\u003e 'from@example.com'\n);\n\n$opentok-\u003edial($sessionId, $token, $sipUri, $options);\n```\n\nFor more information, see the [OpenTok SIP Interconnect developer\nguide](https://tokbox.com/developer/guides/sip/).\n\n### Working with Audio Connector\n\nYou can start an [Audio Connector](https://tokbox.com/developer/guides/audio-connector) WebSocket\nby calling the `connectAudio()` method of the\n`OpenTok\\OpenTok` class.\n\n## Samples\n\nThere are three sample applications included in this repository. To get going as fast as possible, clone the whole\nrepository and follow the Walkthroughs:\n\n- [HelloWorld](sample/HelloWorld/README.md)\n- [Archiving](sample/Archiving/README.md)\n- [SipCall](sample/SipCall/README.md)\n\n## Documentation\n\nReference documentation is available at\n\u003chttps://tokbox.com/developer/sdks/php/reference/index.html\u003e.\n\n## Requirements\n\nYou need an OpenTok API key and API secret, which you can obtain by logging into your\n[Vonage Video API account](https://tokbox.com/account).\n\nThe OpenTok PHP SDK requires PHP 7.2 or higher.\n\n## Release Notes\n\nSee the [Releases](https://github.com/opentok/opentok-php-sdk/releases) page for details\nabout each release.\n\n## Important changes since v2.2.0\n\n**Changes in v2.2.1:**\n\nThe default setting for the `createSession()` method is to create a session with the media mode set\nto relayed. In previous versions of the SDK, the default setting was to use the OpenTok Media Router\n(media mode set to routed). In a relayed session, clients will attempt to send streams directly\nbetween each other (peer-to-peer); if clients cannot connect due to firewall restrictions, the\nsession uses the OpenTok TURN server to relay audio-video streams.\n\n**Changes in v2.2.0:**\n\nThis version of the SDK includes support for working with OpenTok archives.\n\nThe names of many methods of the API have changed. Many method names have\nchanged to use camel case, including the following:\n\n- `\\OpenTok\\OpenTok-\u003ecreateSession()`\n- `\\OpenTok\\OpenTok-\u003egenerateToken()`\n\nNote also that the `options` parameter of the `OpenTok-\u003ecreateSession()` method has a `mediaMode`\nproperty instead of a `p2p` property.\n\nThe API_Config class has been removed. Store your OpenTok API key and API secret in code outside of the SDK files.\n\nSee the reference documentation\n\u003chttp://www.tokbox.com/opentok/libraries/server/php/reference/index.html\u003e and in the\ndocs directory of the SDK.\n\n## Running code quality tooling\n\nThis library makes use of two code quality tools, plus a full PHPUnit test suite.\n\n* [phpcs](https://github.com/squizlabs/PHP_CodeSniffer)\n\nTo run phpcs, enter the following on the command line:\n\n```bash\n $ composer run phpcs\n ```\n\n* [phpstan](https://github.com/phpstan/phpstan)\n\nTo run phpstan, enter the following on the command line:\n\n```bash\n $ composer run phpstan\n ```\n\n* [phpunit](https://phpunit.de/)\n\nTo run PhpUnit, enter the following on the command line:\n\n```bash\n $ composer run test\n ```\n\n## Development and Contributing\n\nInterested in contributing? We :heart: pull requests! See the [Development](DEVELOPING.md) and\n[Contribution](CONTRIBUTING.md) guidelines.\n\n## Getting Help\n\nWe love to hear from you so if you have questions, comments or find a bug in the project, let us know! You can either:\n\n- Open an issue on this repository\n- See \u003chttps://support.tokbox.com/\u003e for support options\n- Tweet at us! We're [@VonageDev on Twitter](https://twitter.com/VonageDev)\n- Or [join the Vonage Developer Community Slack](https://developer.nexmo.com/community/slack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentok%2Fopentok-php-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopentok%2Fopentok-php-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopentok%2Fopentok-php-sdk/lists"}