Create a conversion job
masterTo perform a conversion, instantiate a CloudConvert client, build a Job object, and add Task objects to it. Tasks define the operations (e.g., import/url, convert, export/url) and their parameters using the set() method. Finally, call $cloudconvert->jobs()->create($job) to submit the job.
use \CloudConvert\CloudConvert;
use \CloudConvert\Models\Job;
use \CloudConvert\Models\Task;
$cloudconvert = new CloudConvert([
'api_key' => 'API_KEY',
'sandbox' => false
]);
$job = (new Job())
->setTag('myjob-1')
->addTask(
(new Task('import/url', 'import-my-file'))
->set('url','https://my-url')
)
->addTask(
(new Task('convert', 'convert-my-file'))
->set('input', 'import-my-file')
->set('output_format', 'pdf')
->set('some_other_option', 'value')
)
->addTask(
(new Task('export/url', 'export-my-file'))
->set('input', 'convert-my-file')
);
$cloudconvert->jobs()->create($job);