dev-master
9999999-devUpload videos to a K-Link Streaming Service
MIT
The Requires
- php >=7.0
- kitetail/zttp ^0.2.0
- symfony/process ~3.2
The Development Requires
by Alessio
Wallogit.com
2017 © Pedro Peláez
Upload videos to a K-Link Streaming Service
Contact a K-Link Video Streaming service via API., (*1)
Not usable on Alpine linux as requires an executable not compiled for alpine, (*2)
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"
}
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);
There is no full documentation yet, for usage examples you might want to have a look at the Integration tests, (*12)
The code testing is automated using PHPUnit., (*13)
There are 3 testing suites:, (*14)
Unit: test classes in isolationFeature: test the features of the Client class using mocked responsesIntegration: test the features using a real K-Link Video Streaming serviceThe 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)
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)
This project is licensed under the MIT license., (*20)
Upload videos to a K-Link Streaming Service
MIT