LV

Application integration

# Laravel + Transloadit

Send a validated Laravel upload to a fixed Transloadit Template with the official PHP SDK and server-side credentials.

Executable recipe

## Build the integration

This controller validates an uploaded file, starts a fixed Template through the PHP SDK, and returns the Assembly status payload.

1. Install the PHP SDK and create a Transloadit Template.
2. Add the three environment values and map them in config/services.php.
3. Register a POST route for the controller and submit a multipart file field named file.

### Install

```
composer require transloadit/php-sdk
```

### config/services.php

```
'transloadit' => [
    'key' => env('TRANSLOADIT_KEY'),
    'secret' => env('TRANSLOADIT_SECRET'),
    'template_id' => env('TRANSLOADIT_TEMPLATE_ID'),
],
```

### app/Http/Controllers/MediaController.php

```
<?php

namespace App\Http\Controllers;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use transloadit\Transloadit;

class MediaController extends Controller
{
    public function store(Request $request): JsonResponse
    {
        $validated = $request->validate([
            'file' => ['required', 'file', 'max:102400'],
        ]);

        $transloadit = new Transloadit([
            'key' => config('services.transloadit.key'),
            'secret' => config('services.transloadit.secret'),
        ]);

        $assembly = $transloadit->createAssembly([
            'files' => [$validated['file']->getRealPath()],
            'params' => [
                'template_id' => config('services.transloadit.template_id'),
            ],
        ]);

        return response()->json($assembly->data, 202);
    }
}
```

## Authentication

* Store the Transloadit Auth Key, Auth Secret, and Template ID in Laravel environment configuration and read them through config/services.php.
* The official PHP SDK signs Assembly requests automatically when both the key and secret are supplied.
* Validate uploaded files and enforce your application’s authorization before sending a server-side file to Transloadit.

## Limitations and operational notes

* createAssembly starts the Assembly but does not make long processing synchronous. Return the Assembly ID and use webhooks or status retrieval for completion.
* The example uploads through the Laravel server. For large browser uploads, use Uppy to send bytes directly to Transloadit and let Laravel only authorize signatures.
* Laravel’s public storage validation and your Transloadit Template limits are separate controls; configure both for the same product policy.

## Related Robots

* [/upload/handle](/docs/robots/upload-handle.md)\
  Handle uploads
* [/image/resize](/docs/robots/image-resize.md)\
  Resize images
* [/video/encode](/docs/robots/video-encode.md)\
  Encode video

## Documentation

* [Transloadit PHP SDK documentation](/docs/sdks/php-sdk.md)
* [Transloadit webhook documentation](/docs/topics/webhooks.md)
* [Laravel configuration documentation⁠](https://laravel.com/docs/12.x/configuration)
* [Laravel file validation documentation⁠](https://laravel.com/docs/12.x/validation#validating-files)
  [Create a Template](/c/templates/new/)

More integrations

## Continue building your stack

NX

### [Next.js](/integrations/nextjs.md)

Signed Uppy uploads for the Next.js App Router.

PY

### [Python](/integrations/python.md)

Run signed Assembly jobs with the maintained Python SDK.

RB

### [Ruby](/integrations/ruby.md)

Create and monitor signed Assemblies from Ruby.
