Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Streamlike/php-api-sdk


https://github.com/Streamlike/php-api-sdk

Last synced: 4 days ago
JSON representation

Awesome Lists containing this project

README

        

# Streamlike PHP API SDK

## Requirements

PHP needs to be a minimum version of PHP 5.4.0.

## Installation

Download package and include Sdk.php classe.

Or with composer:

`composer require streamlike/php-api-sdk`

## Samples

### Autoloading

```php
authenticate($login, $password);

$sessionToken = $result['token'];

var_dump($sessionToken);
} catch (\Exception $e) {
if ($e instanceof Streamlike\Api\Exception\InvalidInputException) {
print_r($e->getErrors());
}
}
```

### GET medias list

```php
call('medias');

var_dump($result);
} catch (\Exception $e) {
// handle errors
}

```

### POST a new media

```php
'via sdk',
'permalink' => 'via-sdk',
'type' => 'video',
'visibility' => [
'state' => 'online',
],
];

$files = [
'source' => [
'encode' => [
'media_file' => '/path/to/video/file',
],
],
];

$result = $sdk->call('medias', 'POST', $data, $files);
} catch (\Exception $e) {
if ($e instanceof Streamlike\Api\Exception\InvalidInputException) {
print_r($e->getErrors());
}
}
```

## Running tests

Do a `git clone` on the Github repository:

```
git clone [email protected]:Streamlike/php-api-sdk.git streamlike-api
cd streamlike-api
```

Install dependencies using composer:

```
composer install
```

Run tests:

```
php vendor/bin/atoum -d tests
```