PHP code example of converter-studio / converter-studio-php
1. Go to this page and download the library: Download converter-studio/converter-studio-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
converter-studio / converter-studio-php example snippets
use ConverterStudio\Client;
$client = new Client(); // the API key comes from CONVERTER_STUDIO_API_KEY
$conversion = $client->convert('IMG_1234.HEIC', 'jpg');
$client->download($conversion, 'photos/'); // photos/IMG_1234.jpg
use ConverterStudio\Client;
$client = new Client(); // or new Client('cvs_live_...')
$conversion = $client->convert('talk.mov', 'mp4', options: ['height' => '720']);
echo $conversion->status, ' ', $conversion->credits, ' ', $conversion->outputName; // done 1 talk.mp4
$path = $client->download($conversion, 'out/'); // a folder (ending in / or existing), or a file path
$upload = $client->upload('scan.pdf'); // large files go in parts
$created = $client->createConversion('docx', uploadId: $upload->id, options: ['ocr' => true]);
$created = $client->createConversion('jpg', url: 'https://example.com/photo.heic');
$current = $client->getConversion($created->id); // status now
$current = $client->getConversion($created->id, wait: 30); // the API holds the answer up to 30 s
$done = $client->wait($created, timeout: 900);
use ConverterStudio\Client;
use ConverterStudio\Http\CurlTransport;
$client = new Client(
apiKey: 'cvs_live_...', // default: CONVERTER_STUDIO_API_KEY
baseUrl: 'https://converter.studio/api', // default: CONVERTER_STUDIO_BASE_URL or this
timeout: 60.0, // seconds to connect, and seconds a request may go without progress
maxRetries: 2, // network errors, 408, 429, 5xx
transport: new CurlTransport([CURLOPT_PROXY => 'http://proxy:3128']), // curl options of your own
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.