Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Streamlike/php-api-sdk
https://github.com/Streamlike/php-api-sdk
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/Streamlike/php-api-sdk
- Owner: Streamlike
- Created: 2018-03-02T14:25:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T12:47:18.000Z (over 3 years ago)
- Last Synced: 2024-10-29T00:57:55.226Z (14 days ago)
- Language: PHP
- Homepage: https://www.streamlike.eu
- Size: 9.77 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
```