foxws / laravel-shaka
A Laravel package to interact with Shaka Packager for media packaging.
Fund package maintenance!
Requires
- php: ^8.3
- aws/aws-sdk-php: ^3.295
- guzzlehttp/promises: ^2.0||^3.0
- illuminate/contracts: ^12.0||^13.0
- illuminate/filesystem: ^12.0||^13.0
- illuminate/process: ^12.0||^13.0
- illuminate/support: ^12.0||^13.0
- psr/log: ^3.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- league/flysystem-aws-s3-v3: ^3.35
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0 || ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
- spatie/laravel-ray: ^1.35
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.2
- 2.0.1
- 2.0.0
- 1.9.0
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.0
- 1.0.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- dev-phpstan-level-8
- dev-add-homepage-group
- dev-feat-config
- dev-fix-missing-keys
- dev-copilot/sub-pr-2-one-more-time
- dev-copilot/sub-pr-2-again
This package is auto-updated.
Last update: 2026-10-02 11:59:01 UTC
README
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
- PHP 8.3 or higher
- Laravel 12 or 13
- The Shaka Packager binary
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
- CHANGELOG
- Security policy
- Laravel Streamer, for encoding and packaging in one step
- Shaka Packager documentation
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.