iamriajul/laravel-bunny-stream-filesystem-adapter

Use Bunny Stream Filesystem Adapter for Laravel application
12,893
Install
composer require iamriajul/laravel-bunny-stream-filesystem-adapter
Latest Version:v0.0.11
PHP:^7.1|^8.0
Laravel:10 · 11 · 12
License:MIT
Last Updated:Apr 27, 2025
Links: GitHub  ·  Packagist
Maintainer: iamriajul

Bunny Stream for Laravel

This is Laravel Filesystem's Driver for simple integration with Laravel.

Installation

composer require iamriajul/laravel-bunny-stream-filesystem-adapter

Configuration

This package automatically register the service provider and the storage disk for the driver bunny_stream. You can configure the disk in config/filesystems.php:

'bunny_stream' => [
    'driver' => 'bunny_stream',
    'hostname' => env('BUNNY_STREAM_HOSTNAME'),
    'library_id' => env('BUNNY_STREAM_LIBRARY_ID'),
    'api_key' => env('BUNNY_STREAM_API_KEY'),
],

and remember to add the environment variables in your .env file:

BUNNY_STREAM_HOSTNAME=your-stream-cdn.b-cdn.net
BUNNY_API_KEY=your-api-key
BUNNY_STREAM_LIBRARY_ID=123456

Usage

$videoId = Storage::disk('bunny_stream')->put('abc.mp4', file_get_contents('abc.mp4'));
// $videoId = guid from bunny.

 // Enable Direct File Access from Bunny to Access m3u8
return response(Storage::disk('bunny_stream')->get("$videoId/playlist.m3u8"));

Extra Methods

Method Description
get($path) By default returns playlist.m3u8's content, but you can customize it by adding suffix like "$path/playlist.m3u8", "$path/play_240p.mp4" and more.
getHls($path) Returns playlist.m3u8's content, which would be the main entrypoint for any HLS player.
getOriginal($path) As the name suggests, it just returns the original file's content user had uploaded initially
getMp4($path, $quality = '240p,360p,etc') Returns Mp4 file's content, $quality param allows you to customize which file you want, such 240p, 360p, 720p, NOTE: all the quality might not be available depending on the Original file's quality
getMp4($path, $quality = 'low,mid,high') Not recommended to be called in N+1 situation, as this requires API to resolve what resolution is the low, and what is high, mid, etc.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

641,106,524 9,700
laravel/framework

The Laravel Framework.

593,882,149 34,959
laravel/tinker

Powerful REPL for the Laravel framework.

502,645,077 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

418,291,778 609
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

399,241,428 4,660

Version History

Version Released PHP Laravel License
v0.0.11 ^7.1|^8.0 ^10.46|^11|^12 MIT
v0.0.10 ^7.1|^8.0 ^10.46|^11 MIT
v0.0.9 ^7.1|^8.0 ^10.46|^11 MIT
v0.0.8 ^7.1|^8.0 ^10.46|^11 MIT
v0.0.7 ^7.1|^8.0 ^10.46|^11 MIT