PHPackages                             streamone/php-sdk-v3 - 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. streamone/php-sdk-v3

ActiveLibrary

streamone/php-sdk-v3
====================

StreamOne PHP SDK for API version 3

3.2(9y ago)157.4k↓100%2MITPHPPHP &gt;=5.4.0

Since Jun 11Pushed 9y ago4 watchersCompare

[ Source](https://github.com/StreamOneNL/PHP-SDK-v3)[ Packagist](https://packagist.org/packages/streamone/php-sdk-v3)[ Docs](http://streamone.nl)[ RSS](/packages/streamone-php-sdk-v3/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

StreamOne PHP SDK version 3
===========================

[](#streamone-php-sdk-version-3)

This is the SDK that can be used to communicate with the StreamOne Platform by using the StreamOne API version 3.

Table of contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Using composer](#using-composer)
- [Manually](#manually)
- [Usage](#usage)
- [Configuration](#configuration)
- [Platform](#platform)
- [Request](#request)
- [Session](#session)
- [Actor](#actor)
- [Other useful classes](#other-useful-classes)
- [Complete example](#complete-example)
- [License and copyright](#license-and-copyright)

Requirements
------------

[](#requirements)

The SDK requires PHP 5.4 or higher and the [PHP fopen wrappers](http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen) should be enabled.

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

[](#installation)

### Using composer

[](#using-composer)

The recommended way to install the SDK is to use [Composer](http://getcomposer.org). To install, add the following to your `composer.json` file:

```
{
	"require": {
		"streamone/php-sdk-v3": "~3.2"
	}
}
```

Afterwards, you should update the package by running Composer in the directory where the `composer.json` file is located:

```
php composer.phar update streamone/php-sdk-v3
```

### Manually

[](#manually)

You can download a ZIP of the latest release using the "tags" button at the top of the Github page. Place the contents of the ZIP-file somewhere and you can use it. Note that if you use this method you should `require` the files of the SDK yourself.

Usage
-----

[](#usage)

To use the StreamOne SDK, you should first set up a configuration and afterwards you can start communicating with the StreamOne API.

### Configuration

[](#configuration)

To set up a configuration, you should initialize the `StreamOne\API\v3\Config` with the required configuration options:

- **api\_url** (required): this should be the base URL of the API to use. For example: `https://api.streamonecloud.net`.
- **authentication\_type** (required): this should be either `user` or `application` and denotes the type of authentication to use.

For **authentication\_type** `user` the following is required:

- **user\_id** and **user\_psk**: these should contain the ID and preshared key of the user to use for authentication.

For **authentication\_type** `application` the following is required:

- **application\_id** and **application\_psk**: these should contain the ID and preshared key of the application to use for authentication.

In addition, the following optional values can be used:

- **default\_account\_id** (optional): this can be set to the ID of an account and if set, this will be the account to use by default for all API actions.
- **visible\_errors** (optional, defaults to `[2,3,4,5,7]`): a list of all error codes to display prominently. All possible errors are defined in `Status.php`.
- **request\_factory** (optional, defaults to `StreamOne\API\v3\RequestFactory`): factory to use for creating requests. If you want to overwrite it you can pass an implementation of `StreamOne\API\v3\RequestFactoryInterface` here.
- **cache** (optional, defaults to `StreamOne\API\v3\NoopCache`): cache to use for both requests and tokens. Should be an implementation of `StreamOne\API\v3\CacheInterface`.
- **request\_cache** (optional, defaults to `StreamOne\API\v3\NoopCache`): cache to use for requests. Overwrites anything set for **cache** and should also be an implementation of `StreamOne\API\v3\CacheInterface`.
- **token\_cache** (optional, defaults to `StreamOne\API\v3\NoopCache`): cache to use for tokens. Overwrites anything set for **cache** and should also be an implementation of `StreamOne\API\v3\CacheInterface`.
- **use\_session\_for\_token\_cache** (optional, defaults to `true`): if `true`, the session will be used to store token information if using a session. Otherwise the **token\_cache** will always be used.
- **session\_store** (optional, defaults to `StreamOne\API\v3\PhpSessionStore`): the session store to use to store session information and optionally token information (if **use\_session\_for\_token\_cache** is set to `true`).

Note that for **request\_factory**, **cache**, **request\_cache**, **token\_cache** and **session\_store** you can either pass an instance of an object implementing the required interface or an array of values where the first element should be the full class name (including namespace) and the other arguments will be passed to the constructor of that class.

> If you have forgotten your **user\_psk** or **application\_psk** you may reset it via the [StreamOne Manager](https://manager.streamonecloud.net/resetpsk)

An example configuration is as follows:

```
