2017 © Pedro Peláez
 

library php-api-sdk

Use this toolkit to easily call streamlike.com API endpoints

image

streamlike/php-api-sdk

Use this toolkit to easily call streamlike.com API endpoints

  • Wednesday, April 11, 2018
  • by fvilpoix
  • Repository
  • 1 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Streamlike PHP API SDK

Requirements

PHP needs to be a minimum version of PHP 5.4.0., (*1)

Installation

Download package and include Sdk.php classe., (*2)

Or with composer:, (*3)

composer require streamlike/php-api-sdk, (*4)

Samples

Autoloading

<?php

// via composer autoload
require './vendor/autoload.php';

// or basic require
require './src/Streamlike/Api/Sdk.php';

Authentication - Get a session token

<?php

$login = 'myStreamlikeLogin';
$password = 'myStreamlikePassword';

$sdk = new \Streamlike\Api\Sdk();
try {
    $result = $sdk->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

$sdk = new \Streamlike\Api\Sdk($sessionToken);
try {
    $result = $sdk->call('medias');

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

POST a new media

<?php

$sdk = new \Streamlike\Api\Sdk($sessionToken);
try {
    $data = [
        'name' => '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:, (*5)

git clone git@github.com:Streamlike/php-api-sdk.git streamlike-api
cd streamlike-api

Install dependencies using composer:, (*6)

composer install

Run tests:, (*7)

php vendor/bin/atoum -d tests

The Versions

11/04 2018

dev-master

9999999-dev

Use this toolkit to easily call streamlike.com API endpoints

  Sources   Download

proprietary

The Requires

  • php ^5.4||^7
  • ext-curl *

 

The Development Requires

by Mediatech

11/04 2018

1.0.1

1.0.1.0

Use this toolkit to easily call streamlike.com API endpoints

  Sources   Download

proprietary

The Requires

  • php ^5.4||^7
  • ext-curl *

 

The Development Requires

by Mediatech

02/03 2018

1.0.0

1.0.0.0

Use this toolkit to easily call streamlike.com API endpoints

  Sources   Download

proprietary

The Requires

  • php ^5.4||^7
  • ext-curl *

 

The Development Requires

by Mediatech