This Bundle for the Contao CMS provides a OOP PHP wrapper for CloudConvert's API. Convert files from one filetype into an other with ease.

Installs: 2 092

Dependents: 3

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0


2.5.5 2024-02-11 16:37 UTC



Cloudconvert Bundle

This simple bundle for the Contao CMS provides an OOP PHP wrapper for converting files from one format into another using the Cloudconvert API.


Almost everything is possible:

  • docx -> pdf
  • jpeg -> png
  • wav -> mp3
  • csv -> xlsx
  • etc. For a full list of formats visit Cloudconvert.

Free plan (25 credits per day)

Get your free API key for using the Cloudconvert API: Free Plan Cloudconvert

Installation & configuration

Install the extension via the Contao Manager or call composer require markocupic/cloudconvert-bundle in your command line.

In your config/config.yaml you now have to set the api key.

# config/config.yaml
  api_key: '****' # is mandatory
  sandbox_api_key: '****' # is optional
  backend_alert_credit_limit: 100 # is optional /default to: 200 /set to 0 to disable the system alert
  credit_expiration_notification: # is optional
      enabled: true # is optional
      limit: 150 # is optional
      email: ['', ''] # is optional

To complete the installation please run composer install in your command line.




namespace App\Controller;

use Contao\CoreBundle\Framework\ContaoFramework;
use Contao\System;
use Markocupic\CloudconvertBundle\Conversion\ConvertFile;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\Routing\Annotation\Route;

#[Route('/cloudconvert_demo', name: CloudconvertDemoController::class, defaults: ['_scope' => 'frontend'])]
class CloudconvertDemoController extends AbstractController

    public function __construct(
        private readonly ContaoFramework $framework,
        private readonly ConvertFile $convertFile,

     * @throws \Exception
    public function __invoke(): BinaryFileResponse

        $projectDir = System::getContainer()->getParameter('kernel.project_dir');

        $sourcePath = $projectDir.'/files/mswordfile.docx';

        // Basic example (minimal configuration):
        // Convert from docx to pdf
        $objSplFile = $this->convertFile
            // Save converted file in the same
            // directory as the source file.

        $sourcePath = $projectDir.'/files/samplesound.wav';

        // Convert from wav to mp3
        $objSplFile = $this->convertFile

        $sourcePath = $projectDir.'/files/image.jpg';

        // A slightly more sophisticated example:
        $objSplFile = $this->convertFile
            // Sandbox API key has to be set in config/config.yaml
            ->uncached(false) // Enable cache
            ->setCacheHashCode('566TZZUUTTAGHJKUZT') // use the hash of your file to get the file from the cache directory
            // For a full list of possible options
            // please visit
            ->setOption('width', 1200)
            ->setOption('quality', 90)
            // Convert docx file into the png format and
            // save file in a different directory.
            // For a full list of supported formats
            // please visit
            ->convertTo('png', 'files/images/my_new_image.png')

        // Send the converted file to the browser
        return $this->file($objSplFile->getRealPath());