Search by

foxws / laravel-shaka

francoism90

A Laravel package to interact with Shaka Packager for media packaging.

Package info

github.com/foxws/laravel-shaka

pkg:composer/foxws/laravel-shaka

Fund package maintenance!

Foxws

Statistics

Installs: 7 726

Dependents: 0

Suggesters: 0

Stars: 2

Open Issues: 0

2.4.0 2026-10-02 11:50 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Runs Shaka Packager from Laravel to turn video into HLS and DASH streams. Read the source from any Laravel disk, and write the result to any disk.

Shaka Packager packages already-encoded video; it doesn't re-encode. That makes it fast, but it can't create extra qualities. To encode and package in one step, see Laravel Streamer.

See the full documentation: Installation, Usage, URL Resolvers, Queues, Encryption, Configuration, Quick Reference, How It Works, Troubleshooting.

Requirements

Installation

composer require foxws/laravel-shaka
php artisan vendor:publish --tag="shaka-config"

Install the packager binary, then check the setup:

php artisan shaka:info

See Installation for details.

Quick start

use Foxws\Shaka\Facades\Shaka;

$packager = Shaka::fromDisk('media')->open('videos/clip.mp4');

try {
    $packager
        ->addVideoStream('videos/clip.mp4', 'video.mp4')
        ->addAudioStream('videos/clip.mp4', 'audio.mp4')
        ->withMpdOutput('index.mpd')
        ->withHlsMasterPlaylist('master.m3u8')
        ->export()
        ->toDisk('s3')
        ->toPath('streams/clip/')
        ->save();
} finally {
    $packager->cleanupTemporaryFiles();
}

This writes one set of segments with both a DASH manifest and an HLS playlist, and uploads them to streams/clip/ on the s3 disk.

To serve a private stream, rewrite the playlist with signed URLs when it's requested:

return Shaka::dynamicHLSPlaylist('s3')
    ->setMediaUrlResolver(fn (string $path) => Storage::disk('s3')->temporaryUrl("streams/clip/{$path}", now()->addHour()))
    ->open('streams/clip/master.m3u8')
    ->toResponse($request);

See URL Resolvers and Encryption.

Testing

composer test

Links

Credits

This package started from ideas in Laravel FFMpeg and shaka-php.

Used by Stry, a self-hosted video streaming app.

AI, specifically Claude, was used to help build this package. All AI-assisted output is reviewed by me, and I retain final say over everything that is implemented and released.

License

MIT. See License File.