Laravel¶
oliviuus/rightra-laravel provides a Blade component that renders the Rightra player and a helper that mints upload tokens for the upload helper.
Requirements¶
- PHP 8.1 or later
- Laravel 10, 11, 12, or 13
Installation¶
The service provider is auto-discovered. To edit the configuration file, publish it:
Configuration¶
RIGHTRA_API_KEY=rk_live_your_key
RIGHTRA_SDK_URL=https://unpkg.com/@oliviuus/rightra-sdk@0.1.3/dist/rightra.umd.js
RIGHTRA_UPLOAD_SECRET=your-upload-secret
RIGHTRA_UPLOAD_TOKEN_TTL=900
| Variable | Required | Description |
|---|---|---|
RIGHTRA_API_KEY |
Yes | API key passed to the browser SDK. If unset, the component renders a notice instead of a player and playback fails closed. |
RIGHTRA_SDK_URL |
Yes | URL of the browser SDK build. Pin it to an exact version. |
RIGHTRA_UPLOAD_SECRET |
Yes | Secret used to sign upload tokens. Must match the secret in rightra-upload.php. |
RIGHTRA_UPLOAD_TOKEN_TTL |
No | Upload token lifetime in seconds. Default 900. |
Player component¶
<x-rightra-player
content-id="RTR-853D-52D0"
manifest-url="https://your-storage.example/manifest.json"
viewer-id="{{ auth()->id() }}"
viewer-label="{{ auth()->user()->name }}"
territory="RW"
/>
| Prop | Required | Description |
|---|---|---|
content-id |
Yes | Rightra content ID. |
manifest-url |
Yes | URL of the manifest on your storage. |
viewer-id |
Yes | Stable viewer identifier from your own system, for example auth()->id(). |
viewer-label |
No | Display label. |
territory |
No | Two-letter territory code. Default RW. |
aspect |
No | Aspect ratio as an integer. Default 16. |
The component renders a container, loads the SDK from RIGHTRA_SDK_URL, and initializes the player. No additional script is required.
Upload tokens¶
use Oliviuus\Rightra\Support\UploadToken;
$token = UploadToken::mint('RTR-853D-52D0');
// Override the lifetime in seconds
$token = UploadToken::mint('RTR-853D-52D0', 300);
Token format and usage: Upload tokens.
Token route¶
use Illuminate\Http\Request;
use Oliviuus\Rightra\Support\UploadToken;
Route::post('/rightra/token', function (Request $request) {
$request->validate(['content_id' => 'required|string']);
return ['token' => UploadToken::mint($request->input('content_id'))];
})->middleware('auth');
Errors¶
UploadToken::mint throws RuntimeException when RIGHTRA_UPLOAD_SECRET is not set. This indicates a configuration problem.
The component does not throw. If RIGHTRA_API_KEY is empty, it renders a notice in place of the player.
The package stores no data and requires no migrations, queues, or scheduled commands.