PHPackages                             motomedialab/bunny - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. motomedialab/bunny

ActiveLibrary[File &amp; Storage](/categories/file-storage)

motomedialab/bunny
==================

An integration with BunnyCDN to upload and check on the status of streamed videos

v1.1.0(3mo ago)0296↓33.3%MITPHPPHP ^8.2CI passing

Since Jan 16Pushed 3mo agoCompare

[ Source](https://github.com/motomedialab/bunny)[ Packagist](https://packagist.org/packages/motomedialab/bunny)[ Docs](https://github.com/motomedialab/bunny)[ RSS](/packages/motomedialab-bunny/feed)WikiDiscussions main Synced today

READMEChangelog (8)Dependencies (12)Versions (9)Used By (0)

MotoMediaLab BunnyCDN Integration
=================================

[](#motomedialab-bunnycdn-integration)

[![MIT License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://choosealicense.com/licenses/mit/)[![Latest Version on Packagist](https://camo.githubusercontent.com/79bb61ae93a6fe94b2ca36dbc1b82a68c69f538336ed9473ee19fcb624020427/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f746f6d656469616c61622f62756e6e792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/motomedialab/bunny)[![Total Downloads](https://camo.githubusercontent.com/919ecaf44897ef492342ad479882cde208074252b72723c827b8a84347d55d7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f746f6d656469616c61622f62756e6e792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/motomedialab/bunny)[![Tests](https://github.com/motomedialab/bunny/actions/workflows/tests.yml/badge.svg)](https://github.com/motomedialab/bunny/actions/workflows/tests.yml)

This is an expanding library of [bunny.net](https://bunny.net/) integrations developed by MotoMediaLab. Currently, it only supports uploading of videos via the Bunny Stream fetch method and some basic integration around this. As our requirements expand, this package will be updated with new functionality.

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

[](#installation)

Installation can be achieved quickly and easily using Composer:

```
composer require motomedialab/bunny
```

Configuration
-------------

[](#configuration)

Below are the configuration parameters for Bunny Stream:

```
# library ID that videos should be uploaded to
BUNNY_STREAM_LIBRARY_ID=12345

# the CDN hostname for your stream configuration
BUNNY_STREAM_HOSTNAME=vz-xyz.b-cdn.net

# the API key for bunny stream (this is different from your account API key!)
BUNNY_STREAM_API_KEY=YOUR_API_KEY
```

Uploading a video
-----------------

[](#uploading-a-video)

This library consolidates the process of uploading a video into a series of jobs. To upload a video, you need the URL of the video location and a title at a minimum.

```
// invokable class to trigger an upload job
app()->call(\Motomedialab\Bunny\Actions\UploadVideoFromUrl::class, [
    'url' => 'https://example.com/file.mp4',
    'title' => 'The video title'
]);
```

### The Upload Flow

[](#the-upload-flow)

The upload process is designed to be entirely asynchronous, leveraging Laravel's queueing system. When you call the `UploadVideoFromUrl` invokable action, the following steps are initiated:

1. An `UploadVideoFromUrl` job is dispatched to the queue.
2. When the job is processed, it makes an API call to Bunny.net, instructing it to fetch the video from the specified URL.
3. If the API call fails for any reason, a `VideoUploadFailed` event is dispatched and the process ends.
4. On success, a `CheckVideoTranscodingProgress` job is dispatched to the queue with a 2-minute delay. This is to give Bunny.net time to start the transcoding process.
5. The `CheckVideoTranscodingProgress` job will then:
    - Fire a `VideoTranscoding` event with the current progress of the transcoding.
    - If the transcoding is finished, a `VideoTranscodingFinished` event is fired.
    - If the transcoding fails, a `VideoTranscodingFailed` event is fired.
    - If the initial upload failed, a `VideoUploadFailed` event is fired.
    - If the video is still transcoding, the job will re-dispatch itself with a 30-second delay.

This cycle will continue until the video has finished transcoding or an error occurs.

### Events

[](#events)

This package fires several events throughout the upload and transcoding process, allowing you to hook into the workflow and react accordingly.

---

#### `Motomedialab\Bunny\Events\VideoTranscoding`

[](#motomedialabbunnyeventsvideotranscoding)

This event is fired each time the `CheckVideoTranscodingProgress` job runs and the video is still transcoding. It provides the current progress of the transcoding, allowing you to display a progress bar or other feedback to the user.

---

#### `Motomedialab\Bunny\Events\VideoTranscodingFinished`

[](#motomedialabbunnyeventsvideotranscodingfinished)

Once the video has been successfully transcoded, this event is fired. This is the point where you would typically update your database, associate the video with a model, and make it available to your users.

---

#### `Motomedialab\Bunny\Events\VideoTranscodingFailed`

[](#motomedialabbunnyeventsvideotranscodingfailed)

If the transcoding process fails for any reason, this event will be fired. You can inspect the `$event->video->transcodingMessages()` to get more information on the type of failure.

---

#### `Motomedialab\Bunny\Events\VideoUploadFailed`

[](#motomedialabbunnyeventsvideouploadfailed)

This event is dispatched if the initial upload fails. This can happen for a variety of reasons, such as an invalid URL or an API error. The event will contain the API error or video object where applicable, along with any metadata you passed.

### Metadata

[](#metadata)

To track your conversion job throughout the process, we recommend sending metadata. This is shared throughout the workflow so you can react to the events later on.

```
// dispatch job with metadata
app()->call(\Motomedialab\Bunny\Actions\UploadVideoFromUrl::class, [
    'url' => 'https://example.com/file.mp4',
    'title' => 'The video title',
    'metadata' => [
        'model' => 'App\Models\Post',
        'model_id' => 12,
    ]
]);

// listen for the transcoding finished event
class VideoTranscodingListener
{
    public function __construct(\Motomedialab\Bunny\Events\VideoTranscodingFinished $event)
    {
        if ($event->metadata('model') === 'App\Models\Post') {
            // ToDo: find your post and assign the video...
        }
    }
}
```

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

[](#contributing)

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

License
-------

[](#license)

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

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance82

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~12 days

Recently: every ~17 days

Total

7

Last Release

95d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2487374?v=4)[Chris Page](/maintainers/chrispage1)[@chrispage1](https://github.com/chrispage1)

---

Top Contributors

[![chrispage1](https://avatars.githubusercontent.com/u/2487374?v=4)](https://github.com/chrispage1 "chrispage1 (19 commits)")

---

Tags

bunnyCDNmotomedialabbunny-stream

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/motomedialab-bunny/health.svg)

```
[![Health](https://phpackages.com/badges/motomedialab-bunny/health.svg)](https://phpackages.com/packages/motomedialab-bunny)
```

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3417.0k](/packages/duncanmcclean-statamic-cargo)[slimani/filament-media-manager

A media manager plugin for Filament.

126.9k](/packages/slimani-filament-media-manager)

PHPackages © 2026

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