PHP SDK for OnlineUniConverter APIs

v2.0.0 2021-05-26 06:44 UTC

This package is auto-updated.

Last update: 2022-08-07 12:57:52 UTC


This is the official PHP SDK v2 for the OnlineUniConverter API v2.

Tests Latest Stable Version Total Downloads Latest Unstable Version License


To install the PHP SDK you will need to be using Composer in your project.

Install the SDK alongside Guzzle 7:

composer require onlineuniconverter/onlineuniconverter-php

This package is not tied to any specific HTTP client. Instead, it uses Httplug to let users choose whichever HTTP client they want to use.

If you want to use Guzzle 6 instead, use:

composer require onlineuniconverter/onlineuniconverter-php

You can use the OnlineUniConverter Api to see the available options for the various task types.

Creating Import Tasks

use OnlineUniConverter\Models\Import;

// init
$import = (new Import('import/upload'));

// upload
$response = $this->OnlineUniConverter->imports()->upload($import, fopen(__DIR__ . '/files/单独.mov', 'r'), '');

// info

Creating Convert Tasks

use OnlineUniConverter\Models\Task;

// init
$task = (new Task('convert'))->set('input', 'jnthak3k-amuk-bj8l-cj7h-nn1yno4jty8i')->set('output_format', 'mp4');

// info

Creating Export Tasks

use OnlineUniConverter\Models\Common;
use OnlineUniConverter\Models\Export;

// init
$export = (new Export('export/url'))->set('input', '2w2y610m-awgo-bt8q-cq2p-981fu1w1bmr0');

// info

// download
$source = $this->OnlineUniConverter->getHttpTransport()->download($export->getResult()->files[0]->url)->detach();

$dest = tmpfile();
$destPath = stream_get_meta_data($dest)['uri'];
stream_copy_to_stream($source, $dest);

You can use the OnlineUniConverter to see the available options for the various task types.

Unit Tests

vendor/bin/phpunit --testsuite unit

Feature Tests

vendor/bin/phpunit --testsuite feature

By default, this runs the integration tests against the Sandbox API with an official OnlineUniConverter account. If you would like to use your own account, you can set your API key using the ONLINEUNICONVERT_API_KEY enviroment variable. In this case you need to whitelist the following MD5 hashes for Sandbox API (using the OnlineUniConverter dashboard).

684321sdfew31fsdfes6812381e2ewr2  input.mp4
68531sdfsdf684sefsd68465sdfesf28  input.png