oneofftech / k-link-streaming-upload-client
Upload videos to a K-Link Streaming Service
Installs: 5 392
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: >=7.2.5
- doctrine/annotations: ^1.4
- doctrine/cache: ^1.6
- php-http/client-common: ^1.5|^2.0
- php-http/client-implementation: ^1.0|^2.0
- php-http/discovery: ^1.3
- php-http/message: ^1.6
- symfony/process: ^4.0|^5.0
Requires (Dev)
- guzzlehttp/psr7: ^1.6
- http-interop/http-factory-guzzle: ^1.0
- mockery/mockery: ^1.4
- php-http/curl-client: ~1.7.0|^2.0
- php-http/mock-client: ^1.0
- phpunit/phpunit: ^8.5
- ramsey/uuid: ^4.0
This package is auto-updated.
Last update: 2024-12-05 03:13:11 UTC
README
Contact a K-Link Video Streaming service via API.
Not usable on Alpine linux as requires an executable not compiled for alpine
Getting started
Installation
Require the package with
composer require php-http/guzzle6-adapter guzzlehttp/psr7 oneofftech/k-link-streaming-upload-client
Why requiring so many packages?
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.
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.
Post install/update/require
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.
You could do it via bash/shell
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
"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.
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
Testing
The code testing is automated using PHPUnit.
There are 3 testing suites:
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 service
The tests can be executed using
vendor/bin/phpunit
Executing integration tests
Integration tests requires to set the VIDEO_STREAMING_SERVICE_URL
environment variable to the URL of a running K-Link Video Streaming service.
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.
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.
License
This project is licensed under the MIT license.