PHPackages                             otoyinc/xio-php - 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. otoyinc/xio-php

ActiveLibrary[API Development](/categories/api)

otoyinc/xio-php
===============

X.IO integration library for PHP

1.0.0(11y ago)012MITJavaScriptPHP &gt;=5.2.0

Since Jan 8Pushed 11y ago1 watchersCompare

[ Source](https://github.com/OTOY/xio-php)[ Packagist](https://packagist.org/packages/otoyinc/xio-php)[ Docs](http://github.com/otoyinc/xio-php)[ RSS](/packages/otoyinc-xio-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

X.IO API PHP Library
====================

[](#xio-api-php-library)

Author: \[Mike Christopher\] (mike.christopher (a) otoy (.) c�om)

Company: [OTOY](http://www.otoy.com)

Version: 1.0.0

Date: 2015-01-08

Repository:

Parts of this library are based on  and

For more details on the X.IO API requirements visit

To start working with the library, create a new instance of the Services\_XIO class, passing your API Key ID as the first parameter and API Secret Key as the second.

```
$xio = new Services_XIO('R45KU9BJWTKM4ATGZNKF29LJZ', 'F2kiGEZuhv7D7AEujAiwgLKVjZjP28pa0P96pbiw');
```

Once you have created the object, you can use it to interact with the API. For full information, see the Documentation folder, but here is a quick overview of some of the functions that can be called:

```
$xio->streams->create($array);
$xio->streams->details($stream_id);
$xio->streams->cancel($stream_id);
```

Any errors will throw a Services\_XIO\_Exception. You can call getErrors() on an exception and it will return any errors received from the X.IO API.

STARTING A STREAM
-----------------

[](#starting-a-stream)

The Services\_XIO\_Streams object creates an stream session using [cURL](http://php.net/manual/en/book.curl.php)to send [JSON](http://en.wikipedia.org/wiki/JSON) formatted parameters to X.IO's API.

### Step 1

[](#step-1)

Visit the [API documentation](http://docs.x.io/v1/docs) and build a sample request.

### Step 2

[](#step-2)

Copy the successful JSON string, starting with the first curly brace "{", and pass it as the parameters for a new Services\_XIO\_Streams object. Execute the script on your server to test that it works.

#### Example

[](#example)

```
