1. Go to this page and download the library: Download api2convert/sdk 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/ */
api2convert / sdk example snippets
$client = new Api2Convert\Api2Convert('YOUR_API_KEY');
$client->convert('invoice.docx', 'pdf')->save('invoice.pdf');
use Api2Convert\Api2Convert;
// Reads the API2CONVERT_API_KEY environment variable when no key is passed.
$client = new Api2Convert('YOUR_API_KEY');
// 1) From a local file
$client->convert('photo.png', 'jpg')->save('photo.jpg');
// 2) From a URL
$client->convert('https://example.com/photo.png', 'jpg')->save('photo.jpg');
// 3) With conversion options (discover them via $client->options('jpg'))
$client->convert('photo.png', 'jpg', [
'quality' => 85, 'width' => 1280, 'height' => 720,
])->save('out/'); // the processed file directory
$result = $client->convert('report.docx', 'pdf');
$result->save('report.pdf'); // stream to a file
$result->save('downloads/'); // ...or a directory (keeps the server filename)
$content = $result->contents(); // ...or get the raw bytes
$url = $result->url(); // ...or just the download URL
$result = $client->convert('statement.docx', 'pdf', downloadPassword: 'hunter2');
$result->save('statement.pdf'); // the password is applied for you