2017 © Pedro Peláez
 

library k-link-streaming-upload-client

Upload videos to a K-Link Streaming Service

image

oneofftech/k-link-streaming-upload-client

Upload videos to a K-Link Streaming Service

  • Friday, March 30, 2018
  • by OneOffAdmins
  • Repository
  • 2 Watchers
  • 0 Stars
  • 122 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

K-Link Streaming Service client

Contact a K-Link Video Streaming service via API., (*1)

Not usable on Alpine linux as requires an executable not compiled for alpine, (*2)

Getting started

Installation

Require the package with, (*3)

composer require php-http/guzzle6-adapter guzzlehttp/psr7 oneofftech/k-link-streaming-upload-client

Why requiring so many packages?, (*4)

K-Link Streaming Upload client has a dependency on the virtual package php-http/client-implementation which requires to you install an adapter, but we do not care which one. That is an implementation detail in your application. We also need a PSR-7 implementation and a message factory., (*5)

You do not have to use the php-http/guzzle6-adapter if you do not want to. You may use the php-http/curl-client. Read more about the virtual packages, why this is a good idea and about the flexibility it brings at the HTTPlug docs., (*6)

Post install/update/require, (*7)

The Streaming Service client depends on the Tus Cli, which is not included in this repository to keep the size within a reasonable limit. Composer, for various reasons, don't execute post-install scripts of required packages therefore it needs to be run manually., (*8)

You could do it via bash/shell, (*9)

composer run-script post-install-cmd -d ./vendor/oneofftech/k-link-streaming-upload-client

Or invoke that script from the post-install-cmd/post-update-cmd scripts defined in the composer.json, (*10)

"scripts": {
    "post-install-cmd": "@composer run-script post-install-cmd -d ./vendor/oneofftech/k-link-streaming-upload-client",
    "post-update-cmd": "@composer run-script post-install-cmd -d ./vendor/oneofftech/k-link-streaming-upload-client"
}

Usage

The client requires a registered application on the K-Registry, as the streaming service will verify that the application has the rights to upload videos., (*11)

use Oneofftech\KlinkStreaming\Client;

$streaming_service_url = 'https://streaming.test.klink.asia/';
$application_token = 'Application Token';
$application_url = 'https://myapp.local/';

$client = new Client($streaming_service_url, $application_token, $application_url);

$client->upload($file);

Documentation

There is no full documentation yet, for usage examples you might want to have a look at the Integration tests, (*12)

Testing

The code testing is automated using PHPUnit., (*13)

There are 3 testing suites:, (*14)

  • Unit: test classes in isolation
  • Feature: test the features of the Client class using mocked responses
  • Integration: test the features using a real K-Link Video Streaming service

The tests can be executed using, (*15)

vendor/bin/phpunit

Executing integration tests, (*16)

Integration tests requires to set the VIDEO_STREAMING_SERVICE_URL environment variable to the URL of a running K-Link Video Streaming service., (*17)

Leaving the VIDEO_STREAMING_SERVICE_URL variable empty will cause the integration tests to be skipped. The available phpunit.xml.dist already have that variable, you only need to copy phpunit.xml.dist to phpunit.xml and execute it., (*18)

Contributing

Thank you for considering contributing to the K-Link Streaming Service PHP Client! The contribution guide is not available yet, but in the meantime you can still submit Pull Requests., (*19)

License

This project is licensed under the MIT license., (*20)

The Versions

30/03 2018

dev-master

9999999-dev

Upload videos to a K-Link Streaming Service

  Sources   Download

MIT

The Requires

 

The Development Requires

by Alessio