PHPackages                             martinbean/mux-php-laravel - 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. martinbean/mux-php-laravel

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

martinbean/mux-php-laravel
==========================

Laravel wrapper for the official Mux PHP SDK.

1.3.0(1y ago)88.4k↓90.1%MITPHPCI passing

Since Nov 26Pushed 1y ago2 watchersCompare

[ Source](https://github.com/martinbean/mux-php-laravel)[ Packagist](https://packagist.org/packages/martinbean/mux-php-laravel)[ Fund](https://buymeacoffee.com/martinbean)[ RSS](/packages/martinbean-mux-php-laravel/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (7)Versions (5)Used By (0)

Mux PHP SDK for Laravel
=======================

[](#mux-php-sdk-for-laravel)

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

[](#installation)

```
composer require martinbean/mux-php-laravel
```

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

[](#configuration)

By default, the package expects two environment variables to be defined:

- `MUX_CLIENT_ID`
- `MUX_CLIENT_SECRET`

This should be a Mux access token ID and secret.

You can generate a Mux access token by:

1. Logging into your [Mux dashboard](https://dashboard.mux.com/)
2. Going to “Settings”
3. Then going to “Access Tokens”

### Verifying webhook signatures

[](#verifying-webhook-signatures)

To verify webhook signatures from Mux, specify the signing secret for your webhook endpoint as the value of your `MUX_WEBHOOK_SECRET` environment variable. This means you will need to register your webhook endpoint in the [Mux dashboard](https://dashboard.mux.com/) first.

Usage
-----

[](#usage)

### API clients

[](#api-clients)

The package will register default configuration based on the configured Mux access token. This means you can then type-hint a Mux client in your Laravel application, and it and its dependencies will be automatically resolved:

```
namespace App\Http\Controllers;

use MuxPhp\Api\DirectUploadsApi;

class UploadController extends Controller
{
    protected DirectUploadsApi $uploads;

    public function __construct(DirectUploadsApi $uploads)
    {
        $this->uploads = $uploads;
    }
}
```

### Webhook handling

[](#webhook-handling)

The package will also automatically register a route to listen for webhooks sent by Mux. The URI of this handler is **/mux/webhook**

The webhook handler is heavily based on [Cashier](https://laravel.com/docs/cashier)’s webhook handler. When a webhook from Mux is received, an instance of the `MartinBean\Laravel\Mux\Events\WebhookReceived` event is dispatched containing the webhook’s payload.

You can define a listener that listens for this event:

```
namespace App\Listeners;

use MartinBean\Laravel\Mux\Events\WebhookReceived;

class MuxEventListener
{
    public function handle(WebhookReceived $event): void
    {
        // Handle Mux webhook event...
    }
}
```

This is where you would update models, etc in your application based on events from Mux:

```
  public function handle(WebhookReceived $event): void
  {
-     // Handle Mux webhook event...
+     match ($event->payload['type']) {
+         'video.asset.errored' => $this->handleVideoAssetErrored($event->payload),
+         'video.asset.ready' => $this->handleVideoAssetReady($event->payload),
+         default => null, // unhandled event
+     };
  }
+
+ protected function handleVideoAssetErrored(array $payload): void
+ {
+     // TODO: Retrieve associated video
+     // TODO: Update video status to 'errored'
+     // TODO: Notify user processing video errored
+ }
+
+ protected function handleVideoAssetReady(array $payload): void
+ {
+     // TODO: Retrieve associated video
+     // TODO: Update video status to 'ready'
+     // TODO: Notify user processing video succeeded
+ }
```

### Mux Player

[](#mux-player)

The package contains a Blade view component that makes displaying your Mux videos easy.

The only required property is a `playback-id` (in the case that the video has a “public” playback policy):

```

```

If your video has a “signed” playback policy, then you can provide the `playback_token` attribute:

```

```

In fact, any attributes are passed to the underlying Mux Player instance, so you can specify any other documented attributes such as metadata keys:

```

```

#### Manually including the Mux Player JavaScript library

[](#manually-including-the-mux-player-javascript-library)

By default, the `` component will include the required Mux Player JavaScript library from the jsDeliver CDN. If you do not want this, because maybe you’re installing Mux Player via a package such as npm or Yarn and building it with [Vite](https://laravel.com/docs/vite), then you can pass the `no-script` attribute. You *will* then need to make sure you’re including the Mux Player JavaScript yourself:

```
@vite('resources/js/player.js')

```

Contribution
------------

[](#contribution)

Contributions are always welcome. Please open a pull request with your proposed changes, with accompanying tests.

License
-------

[](#license)

Licensed under the [MIT License](LICENSE.md)

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance47

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

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 ~63 days

Total

4

Last Release

394d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cb0c631c9ca0575575f7dfb760bc0462ff52cfd60a2b8b7e4702a0f136cf2c4c?d=identicon)[martinbean](/maintainers/martinbean)

---

Top Contributors

[![martinbean](https://avatars.githubusercontent.com/u/167312?v=4)](https://github.com/martinbean "martinbean (5 commits)")

---

Tags

phplaravelvideomux

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/martinbean-mux-php-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/martinbean-mux-php-laravel/health.svg)](https://phpackages.com/packages/martinbean-mux-php-laravel)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.6k29.9M146](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k15.1M132](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

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

PHPackages © 2026

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