Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.convertly.sh/llms.txt

Use this file to discover all available pages before exploring further.

The Convertly PHP SDK is a small cURL-based client for server-side apps and WordPress plugins.
composer require convertly/convertly-php

Create a client

<?php

require __DIR__ . '/vendor/autoload.php';

use Convertly\ConvertlyClient;

$convertly = new ConvertlyClient(getenv('CONVERTLY_API_KEY'));

Convert an uploaded file

$result = $convertly->convertFile(__DIR__ . '/photo.png', 'webp', [
    'compression' => 'balanced',
    'resizeWidth' => 1600,
    'saveToStorage' => false,
]);

if (!$result['ok']) {
    throw new RuntimeException($result['error']);
}
For raster-to-SVG conversion, color is preserved by default. Pass 'mono' => true only when you want monochrome tracing.

Compress an image

$result = $convertly->compressFile(__DIR__ . '/hero.jpg', [
    'quality' => 82,
    'stripMetadata' => true,
]);
The WordPress plugin uses this SDK internally, so plugin behavior and standalone PHP behavior stay aligned.