PHPackages                             foxws/laravel-streamer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. foxws/laravel-streamer

ActiveLibrary[Image &amp; Media](/categories/media)

foxws/laravel-streamer
======================

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

1.7.0(2mo ago)11.8k↓28.9%MITPHPPHP ^8.3CI passing

Since Feb 6Pushed 1mo agoCompare

[ Source](https://github.com/foxws/laravel-streamer)[ Packagist](https://packagist.org/packages/foxws/laravel-streamer)[ Docs](https://github.com/foxws/laravel-streamer)[ GitHub Sponsors](https://github.com/Foxws)[ RSS](/packages/foxws-laravel-streamer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (38)Versions (19)Used By (0)

Laravel Shaka Streamer
======================

[](#laravel-shaka-streamer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1b80a27c97f977ea5bb88edbd353a449f849f3ab1828e7eb5a0f90bda20e96bd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f7877732f6c61726176656c2d73747265616d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/foxws/laravel-streamer)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d8711174503c45d25c3409a8a0f1786004f6555143cbf2211c1076332155ecbe/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666f7877732f6c61726176656c2d73747265616d65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/foxws/laravel-streamer/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/de1fc4cd28c09cb8a0762047fbb9886e76ce7983e7fa3102ce49c505ce4dde56/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666f7877732f6c61726176656c2d73747265616d65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/foxws/laravel-streamer/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/020cefa4b2dc6b486dd16435569c8f0050406fdc8101c64e9ff69f982fcb71b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f7877732f6c61726176656c2d73747265616d65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/foxws/laravel-streamer)

A Laravel integration for [Google's Shaka Streamer](https://github.com/shaka-project/shaka-streamer), enabling you to package adaptive streaming content (HLS, DASH) with a fluent, Laravel-style API.

```
use Foxws\Streamer\Facades\Streamer;

Streamer::fromDisk('s3')
    ->open('videos/input.mp4')
    ->addVideoStream('videos/input.mp4', 'video.mp4')
    ->addAudioStream('videos/input.mp4', 'audio.mp4')
    ->withHlsMasterPlaylist('master.m3u8')
    ->withSegmentDuration(6)
    ->export()
    ->toDisk('export')
    ->save();
```

Features
--------

[](#features)

- 🎬 **Fluent API** — Laravel-style chainable methods for packaging media
- 📁 **Filesystem Integration** — Read from and write to any Laravel disk (local, S3, etc.)
- 🎯 **Adaptive Bitrate** — Create multi-quality HLS &amp; DASH streams
- 🔒 **AES Encryption** — Built-in content protection with optional key rotation
- 📺 **Dynamic Manifests** — Rewrite HLS playlists and DASH MPDs with signed URLs at serve-time
- 📡 **Events** — Hooks for `StreamingStarted`, `StreamingCompleted`, and `StreamingFailed`
- 📝 **PHP 8.3+** — Strict types, readonly properties, and modern PHP throughout

Documentation
-------------

[](#documentation)

- [Quick Reference](docs/QUICK_REFERENCE.md) — Complete API at a glance
- [Configuration](docs/CONFIGURATION.md) — Environment variables and config options
- [AES Encryption](docs/AES_ENCRYPTION.md) — Encryption with key rotation
- [URL Resolvers](docs/URL_RESOLVERS.md) — Signed URLs for HLS &amp; DASH
- [Troubleshooting](docs/TROUBLESHOOTING.md) — Common issues and solutions

Requirements
------------

[](#requirements)

- PHP 8.3+
- Laravel 12 or 13
- [Shaka Streamer](https://github.com/shaka-project/shaka-streamer) binary (`pip install shaka-streamer`)

Installation
------------

[](#installation)

```
composer require foxws/laravel-streamer
```

Publish the configuration file:

```
php artisan vendor:publish --tag="streamer-config"
```

Verify the binary is accessible:

```
php artisan streamer:info
```

Quick Start
-----------

[](#quick-start)

### Basic Packaging

[](#basic-packaging)

```
use Foxws\Streamer\Facades\Streamer;

Streamer::open('input.mp4')
    ->addVideoStream('input.mp4', 'video.mp4')
    ->addAudioStream('input.mp4', 'audio.mp4')
    ->withHlsMasterPlaylist('master.m3u8')
    ->export()
    ->save();
```

### Cross-Disk Workflows

[](#cross-disk-workflows)

Read from one disk, write to another:

```
Streamer::fromDisk('s3')
    ->open('videos/input.mp4')
    ->addVideoStream('videos/input.mp4', 'video.mp4')
    ->addAudioStream('videos/input.mp4', 'audio.mp4')
    ->withHlsMasterPlaylist('master.m3u8')
    ->export()
    ->toDisk('export')
    ->toPath('streams/')
    ->withVisibility('public')
    ->save();
```

### Encryption

[](#encryption)

```
// AES-128 encryption with auto-generated key
Streamer::open('input.mp4')
    ->addVideoStream('input.mp4', 'video.mp4')
    ->addAudioStream('input.mp4', 'audio.mp4')
    ->withHlsMasterPlaylist('master.m3u8')
    ->withAESEncryption()
    ->export()
    ->save();

// With key rotation (rotates every 60 seconds)
Streamer::open('input.mp4')
    ->addVideoStream('input.mp4', 'video.mp4')
    ->addAudioStream('input.mp4', 'audio.mp4')
    ->withHlsMasterPlaylist('master.m3u8')
    ->withAESEncryption('key', 'cenc')
    ->withKeyRotationDuration(60)
    ->export()
    ->toDisk('s3')
    ->save();
```

See the [AES Encryption Guide](docs/AES_ENCRYPTION.md) for protection schemes, codec-specific examples, and key management.

### Dynamic URL Resolvers

[](#dynamic-url-resolvers)

Serve HLS and DASH content with signed URLs — useful for S3, CDNs, or multi-tenant apps.

**HLS:**

```
use Foxws\Streamer\Http\DynamicHLSPlaylist;
use Illuminate\Support\Facades\Storage;

return (new DynamicHLSPlaylist('s3'))
    ->open("videos/{$video->id}/master.m3u8")
    ->setKeyUrlResolver(fn (string $key) => Storage::disk('s3')->temporaryUrl(
        "videos/{$video->id}/{$key}",
        now()->addHour(),
    ))
    ->setMediaUrlResolver(fn (string $file) => Storage::disk('s3')->temporaryUrl(
        "videos/{$video->id}/{$file}",
        now()->addHours(2),
    ))
    ->setPlaylistUrlResolver(fn (string $playlist) => route('video.playlist', [
        'video' => $video,
        'playlist' => $playlist,
    ]))
    ->toResponse(request());
```

**DASH:**

```
use Foxws\Streamer\Http\DynamicDASHManifest;
use Illuminate\Support\Facades\Storage;

return (new DynamicDASHManifest('s3'))
    ->open("videos/{$video->id}/manifest.mpd")
    ->setMediaUrlResolver(fn (string $file) => Storage::disk('s3')->temporaryUrl(
        "videos/{$video->id}/{$file}",
        now()->addHours(2),
    ))
    ->setInitUrlResolver(fn (string $file) => Storage::disk('s3')->temporaryUrl(
        "videos/{$video->id}/{$file}",
        now()->addHours(2),
    ))
    ->toResponse(request());
```

See [URL Resolvers](docs/URL_RESOLVERS.md) for more details.

### Events

[](#events)

Listen to streaming lifecycle events:

EventPayload`StreamingStarted``MediaCollection $mediaCollection`, `array $options``StreamingCompleted``StreamerResult $result`, `float $executionTime``StreamingFailed``Exception $exception`, `float $executionTime`### Post-Export Inspection

[](#post-export-inspection)

After saving, you can inspect the result:

```
$exporter = Streamer::open('input.mp4')
    ->addVideoStream('input.mp4', 'video.mp4')
    ->addAudioStream('input.mp4', 'audio.mp4')
    ->withHlsMasterPlaylist('master.m3u8')
    ->export();

$exporter->afterSaving(function ($exporter, $result) {
    $summary = $exporter->getCopySummary();
    // ['total' => 12, 'copied' => 12, 'failed' => 0, 'totalSize' => 8421376]

    $keys = $result->getUploadedEncryptionKeys();
});

$exporter->toDisk('s3')->save();
```

API Reference
-------------

[](#api-reference)

### `Streamer` Facade → `MediaOpener`

[](#streamer-facade--mediaopener)

MethodDescription`fromDisk($disk)`Set the source filesystem disk`open($paths)`Open one or more media files`openFromDisk($disk, $paths)`Set disk and open files in one call`get()`Get the `MediaCollection``export()`Start the export chain (returns `MediaExporter`)`dynamicHLSPlaylist(?string $disk)`Create a `DynamicHLSPlaylist` instance`dynamicDASHManifest(?string $disk)`Create a `DynamicDASHManifest` instance`cleanupTemporaryFiles()`Delete all temporary directories### Stream Configuration (via `MediaOpener` → `Streamer`)

[](#stream-configuration-via-mediaopener--streamer)

MethodDescription`addVideoStream($input, $output, $options)`Add a video stream`addAudioStream($input, $output, $options)`Add an audio stream`addTextStream($input, $output, $options)`Add a text/subtitle stream`addStream(array $stream)`Add a raw Shaka stream descriptor (`in`, `stream`, `output`, …)`withHlsMasterPlaylist($path)`Set HLS output`withMpdOutput($path)`Set DASH/MPD output`withSegmentDuration(int $seconds)`Set segment duration`withManifestFormat(array $formats)`Set manifest formats (e.g. `['dash', 'hls']`)`withResolutions(array $resolutions)`Set encoding resolutions`withVideoCodecs(array $codecs)`Set video codecs (e.g. `['h264', 'hw:vp9']`)`withAudioCodecs(array $codecs)`Set audio codecs (e.g. `['aac', 'opus']`)`withSegmentPerFile(bool $enabled)`Enable segment-per-file output`withLowLatencyDashMode(bool $enabled)`Enable low-latency DASH`withStreamingMode(string $mode)`Set mode (`'vod'` or `'live'`)`withEncryption(array $config)`Set raw encryption config`withAESEncryption($keyFilename, $scheme, $label)`Auto-generate AES encryption key`withKeyRotationDuration(int $seconds)`Enable key rotation (requires `'cenc'` or `'cbcs'`)`withOption($key, $value)`Set a custom pipeline option`withOptions(array $options)`Set multiple custom pipeline options`getCommand()`Get the built config array (for debugging)### `MediaExporter` (returned by `export()`)

[](#mediaexporter-returned-by-export)

MethodDescription`toDisk($disk)`Set target disk for output`toPath(string $path)`Set target subdirectory`withVisibility(string $visibility)`Set file visibility (`'public'`, `'private'`)`afterSaving(callable $callback)`Register post-save callback`save(?string $path)`Execute packaging and copy files to disk`getCommand()`Get the built config array`dd()`Dump config and die`getCopySummary()`Get `{total, copied, failed, totalSize}``getCopiedFiles()`Get array of successfully copied files`getFailedFiles()`Get array of failed file copies`hasCopyFailures()`Check if any files failed to copy### `DynamicHLSPlaylist`

[](#dynamichlsplaylist)

MethodDescription`open(string $path)`Open a playlist file`setKeyUrlResolver(callable)`Resolve encryption key URLs`setMediaUrlResolver(callable)`Resolve media segment URLs`setPlaylistUrlResolver(callable)`Resolve sub-playlist URLs`get()`Get processed playlist content`all()`Get all processed playlists (master + variants)`toResponse($request)`Return as `application/vnd.apple.mpegurl` response### `DynamicDASHManifest`

[](#dynamicdashmanifest)

MethodDescription`open(string $path)`Open a manifest file`setMediaUrlResolver(callable)`Resolve media segment URLs`setInitUrlResolver(callable)`Resolve initialization segment URLs`get()`Get processed manifest content`toResponse($request)`Return as `application/dash+xml` responseConfiguration
-------------

[](#configuration)

Key options in `config/streamer.php`:

OptionDefaultDescription`streamer.streamer_binary``'shaka-streamer'`Path to the Shaka Streamer binary`timeout``14400` (4h)Process timeout in seconds`temporary_files_root``storage_path('app/streamer/temp')`Directory for temporary files`cache_files_root``'/dev/shm'`Fast storage for small files (keys, manifests)`log_channel``null`Log channel for streamer outputSee [Configuration](docs/CONFIGURATION.md) for all options and environment variables.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover a security vulnerability, please report it via a private channel (e.g. email or GitHub Security Advisories) rather than publicly disclosing it.

Acknowledgments
---------------

[](#acknowledgments)

This package was inspired by and learned from:

- [Laravel FFmpeg](https://github.com/protonemedia/laravel-ffmpeg) — Architecture patterns and Laravel integration approach
- [quasarstream/shaka-php](https://github.com/quasarstream/shaka-php) — Shaka Packager wrapper and command building patterns

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance89

Actively maintained with recent releases

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

17

Last Release

62d ago

Major Versions

0.9.0 → 1.0.02026-02-23

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5028905?v=4)[François M.](/maintainers/francoism90)[@francoism90](https://github.com/francoism90)

---

Top Contributors

[![francoism90](https://avatars.githubusercontent.com/u/5028905?v=4)](https://github.com/francoism90 "francoism90 (83 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

dashhlslaravelshakashaka-packagershaka-streamertranscodevodlaravelstreamingaudiovideomediahlsdashshakastreamer

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/foxws-laravel-streamer/health.svg)

```
[![Health](https://phpackages.com/badges/foxws-laravel-streamer/health.svg)](https://phpackages.com/packages/foxws-laravel-streamer)
```

###  Alternatives

[happyworm/jplayer

jPlayer allows you to create a media player with a consistent interface and experience across all browsers.

4.6k114.2k1](/packages/happyworm-jplayer)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[aminyazdanpanah/php-shaka

Shaka PHP is a library that uses Shaka Packager for DASH and HLS packaging and encryption, supporting Common Encryption for Widevine and other DRM Systems.

939.0k1](/packages/aminyazdanpanah-php-shaka)[ralphjsmit/laravel-glide

Auto-magically generate responsive images from static image files.

4719.6k5](/packages/ralphjsmit-laravel-glide)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[saasykit/laravel-open-graphy

An awesome open graph image (social cards) generator package for Laravel.

13057.0k](/packages/saasykit-laravel-open-graphy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
