Looking to hire Laravel developers? Try LaraJobs

runconvert-laravel maintained by runconvert

Description
Official RunConvert SDK for Laravel: convert files between 240+ formats
Last update
2026/11/15 17:31 (dev-main)
License
Downloads
0

Comments
comments powered by Disqus

RunConvert SDK for Laravel

Convert files between 240+ formats with the RunConvert API from Laravel: a configured client, a facade, and a signed webhook route that fires Laravel events. Built on runconvert-php. Laravel 12 and 13; PHP 8.2+.

composer require runconvert/runconvert-laravel
RUNCONVERT_API_KEY=rc_live_...
RUNCONVERT_WEBHOOK_SECRET=whsec_...   # only if you use webhooks
use RunConvert\Laravel\Facades\RunConvert;

$result = RunConvert::convert(storage_path('app/report.docx'), 'pdf', ['out_dir' => storage_path('app/converted')]);
$result->saved; // ['.../converted/report.pdf']

Or inject the client anywhere:

use RunConvert\RunConvert;

public function store(Request $request, RunConvert $rc)
{
    $job = $rc->jobs->create([
        'import' => ['operation' => 'import/url', 'source_url' => $request->input('url')],
        'convert' => ['operation' => 'convert', 'input' => 'import', 'input_format' => 'mp4', 'output_format' => 'mp3'],
        'export' => ['operation' => 'export/url', 'input' => 'convert'],
    ], tag: 'user-' . $request->user()->id);

    return ['job' => $job['id']]; // finish it in a webhook listener instead of waiting here
}

Everything from the PHP SDK is available: jobs, files, operations, me(), convert().

Configuration

php artisan vendor:publish --tag=runconvert-config   # config/runconvert.php
Key Env Default
api_key RUNCONVERT_API_KEY –
base_url RUNCONVERT_BASE_URL https://api.runconvert.com/v3
timeout RUNCONVERT_TIMEOUT 60 seconds
webhook.path RUNCONVERT_WEBHOOK_PATH runconvert/webhook (null turns the route off)
webhook.secret RUNCONVERT_WEBHOOK_SECRET –

Webhooks

Add an endpoint in Dashboard → Webhooks pointing at https://your-app.com/runconvert/webhook and put its secret in RUNCONVERT_WEBHOOK_SECRET. The route checks X-RunConvert-Signature on every delivery (no CSRF token needed), then fires WebhookReceived plus the event's own class:

RunConvert event Laravel event
job.created / job.processing JobCreated / JobProcessing
job.finished JobFinished
job.error JobFailed
task.finished / task.error TaskFinished / TaskFailed
use RunConvert\Laravel\Events\JobFinished;
use RunConvert\Jobs;

Event::listen(function (JobFinished $event) {
    foreach (Jobs::exportedFiles(app(\RunConvert\RunConvert::class)->jobs->get($event->job()['id'])) as $file) {
        // $file['url'] is a temporary download link
    }
});

All events are in RunConvert\Laravel\Events and expose type(), job(), task() and the raw payload.

Development

composer install
vendor/bin/phpunit

License

MIT