PHPackages                             drewroberts/media - 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. drewroberts/media

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

drewroberts/media
=================

Laravel Package for opinionated usage of Media (images &amp; videos)

v12.1.2(8mo ago)647.6k↑584.6%5[13 issues](https://github.com/drewroberts/media/issues)[1 PRs](https://github.com/drewroberts/media/pulls)1MITPHPPHP ^8.4CI passing

Since Jul 8Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/drewroberts/media)[ Packagist](https://packagist.org/packages/drewroberts/media)[ Docs](https://github.com/drewroberts/media)[ GitHub Sponsors](https://github.com/drewroberts)[ RSS](/packages/drewroberts-media/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (24)Versions (41)Used By (1)

Laravel Package for opinionated usage of Media (images &amp; videos)
====================================================================

[](#laravel-package-for-opinionated-usage-of-media-images--videos)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ffdda4f7bbf3178881539ee7c409ce04b1dd19fd7b5097d331835c0fc9eaf093/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64726577726f62657274732f6d656469612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/drewroberts/media)[![GitHub Tests Action Status](https://camo.githubusercontent.com/08c34660a5d61196324f1bf3a065d3b9a3bf2b3bedd75a795ccedf0dc15b066a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64726577726f62657274732f6d656469612f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/drewroberts/media/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e1a26951dc1db41a7621d7d5c8ce814be5d5a1392059f64a28baaf87e6598591/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64726577726f62657274732f6d656469612f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/drewroberts/media/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/8ae42d0dab13f25d7dc742e835fce0b32ed00b228880b466c86e7a904e098cb6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64726577726f62657274732f6d656469612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/drewroberts/media)

The media package utilizes Cloudinary for images and YouTube for videos. Create a free Cloudinary account for each Laravel application utilizing this package here:

- [Cloudinary](https://cloudinary.com)

Models
------

[](#models)

The following models are included in this package:

**List of Models**

- Image
- Tag
- Video

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

[](#installation)

You can install the package via composer:

```
composer require drewroberts/media
```

### Environment variables (Cloudinary Laravel v3)

[](#environment-variables-cloudinary-laravel-v3)

Add your Cloudinary credentials to your `.env` file. Choose one of the following options:

Required env variables:

```
CLOUDINARY_URL=cloudinary://API_KEY:API_SECRET@CLOUD_NAME
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_KEY=
CLOUDINARY_SECRET=
FILESYSTEM_DISK=cloudinary

```

Note

You can get your credentials from your [Cloudinary console](https://cloudinary.com/console).

### Configure the Cloudinary disk (required)

[](#configure-the-cloudinary-disk-required)

Add a `cloudinary` disk to your `config/filesystems.php`:

```
return [
    ...
    'disks' => [
        ...
        'cloudinary' => [
            'driver' => 'cloudinary',
            'key' => env('CLOUDINARY_KEY'),
            'secret' => env('CLOUDINARY_SECRET'),
            'cloud' => env('CLOUDINARY_CLOUD_NAME'),
            'url' => env('CLOUDINARY_URL'),
            'secure' => (bool) env('CLOUDINARY_SECURE', true),
            'prefix' => env('CLOUDINARY_PREFIX'),
        ]
    ]
];
```

> The package expects `filesystems.disks.cloudinary.cloud` to be set. If missing, URL helpers will throw an informative exception.

### Media package config (optional)

[](#media-package-config-optional)

This package ships with `config/media.php` for its own options. You can publish and customize it:

```
php artisan vendor:publish --tag=media-config

```

Available options and defaults:

```
return [
    'transforms' => [
        'cover' => 't_cover',
        'cover_placeholder' => 't_coverplaceholder',
    ],

    // Relative path; wrapped with url() in code when no image exists
    'fallback_image' => 'img/ogimage.jpg',

    // YouTube Data API V3 integration (Non-OAuth)
    'youtube' => [
        // Set in your application's .env
        'api_key' => env('YOUTUBE_API_KEY'),

        // HTTP request options
        'timeout' => 8.0, // seconds
        'base_url' => 'https://www.googleapis.com/youtube/v3',

        // Preferred order for selecting thumbnails
        'thumbnail_preference' => [
            'maxres', 'standard', 'high', 'medium', 'default',
        ],
    ],
];
```

Note

In your Cloudinary console, create a Named Transformation called `t_cover` sized to 1200x630 pixels. This package references that name to render cover images.

Create another Named Transformation `t_coverplaceholder` sized to 120x63 pixels. This is intended as a lightweight loading placeholder, while the full `t_cover` image can be lazy-loaded by the frontend.

### YouTube Data API v3 (Non-OAuth)

[](#youtube-data-api-v3-non-oauth)

This package integrates with the official YouTube Data API v3 using an API key (no OAuth). It is used to parse YouTube links, fetch video details (title, description, duration, publish date, statistics, etc.), and pick the best thumbnail.

Required env variable:

```
YOUTUBE_API_KEY=

```

Notes

- Obtain an API key from your [Google Cloud Console](https://console.developers.google.com/) and enable the YouTube Data API v3 for your project.
- You can customize request timeout, base URL, and thumbnail selection order via `config/media.php` under the `youtube` key (publish the config if needed).
- API quota or configuration issues will surface as clear exceptions; ensure the key is set in environments where the service is used.

Filament Admin Resources
------------------------

[](#filament-admin-resources)

This package ships first‑party Filament resources for managing media:

- Images: Resource, pages, form schema, and table
- Tags: Resource, pages, form schema, and table
- Videos: Resource, pages, form schema, and table, including:
    - Create via YouTube URL/ID (fetches metadata on submit)
    - Edit with read‑only metadata and editable “Internal Name”, “Credit”, and “Thumbnail”
    - A “Refresh API Data” button on the edit page to pull the latest details from YouTube

How they’re registered

- The package provides a Filament plugin that auto‑discovers resources from `DrewRoberts\Media\Filament\Resources`.
- In your Filament Panel config, install the package plugin (if not auto‑discovered in your setup).

User Resource in your application

- This package does not provide a Filament User resource. Your Laravel application should create its own Filament User resource with `php artisan make:filament-resource Customer`
- The media models reference your app’s user model via `config('auth.providers.users.model')` for `creator_id` and `updater_id` relations. No additional wiring is required.

Migrations
----------

[](#migrations)

This package auto-runs its migrations and does not publish them.

The following tables are created:

- images
- videos
- tags
- taggables

Note: Because migrations are auto-loaded, you don’t need to vendor:publish them. If you need to customize the schema, override with your own migrations in your application.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Drew Roberts](https://github.com/drewroberts)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance54

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community22

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 70.1% 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 ~56 days

Recently: every ~414 days

Total

35

Last Release

255d ago

Major Versions

1.0.9 → 2.0.02020-12-22

2.0.4 → 3.0.02021-01-15

3.5.0 → v12.0.02025-08-16

PHP version history (6 changes)1.0.0PHP ^7.4

1.0.1PHP ^7.3

3.0.2PHP ^7.3|^8.0

3.0.3PHP ^7.4|^8.0

v12.0.0PHP ^8.3

v12.1.2PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ccc9e3647546c97a5a77b995736302afd85bebdcb43d8fde7d11486579c30c0?d=identicon)[drewroberts](/maintainers/drewroberts)

---

Top Contributors

[![drewroberts](https://avatars.githubusercontent.com/u/24581081?v=4)](https://github.com/drewroberts "drewroberts (307 commits)")[![gurgentil](https://avatars.githubusercontent.com/u/12678835?v=4)](https://github.com/gurgentil "gurgentil (59 commits)")[![wolfrednicolas](https://avatars.githubusercontent.com/u/13080491?v=4)](https://github.com/wolfrednicolas "wolfrednicolas (19 commits)")[![huntermontell](https://avatars.githubusercontent.com/u/64396917?v=4)](https://github.com/huntermontell "huntermontell (11 commits)")[![kylebarney](https://avatars.githubusercontent.com/u/15039520?v=4)](https://github.com/kylebarney "kylebarney (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![dimayefremov](https://avatars.githubusercontent.com/u/75018798?v=4)](https://github.com/dimayefremov "dimayefremov (5 commits)")[![alliroberts](https://avatars.githubusercontent.com/u/77474875?v=4)](https://github.com/alliroberts "alliroberts (5 commits)")[![prestontoor](https://avatars.githubusercontent.com/u/22110334?v=4)](https://github.com/prestontoor "prestontoor (3 commits)")[![joshtorres](https://avatars.githubusercontent.com/u/5092957?v=4)](https://github.com/joshtorres "joshtorres (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")[![phuclh](https://avatars.githubusercontent.com/u/6707194?v=4)](https://github.com/phuclh "phuclh (2 commits)")[![WebTigers](https://avatars.githubusercontent.com/u/774030?v=4)](https://github.com/WebTigers "WebTigers (1 commits)")

---

Tags

laravellaravel-medialaravel-packagelaravellaravel-packagemedia

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/drewroberts-media/health.svg)

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

###  Alternatives

[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[stephenjude/filament-debugger

About

104162.2k2](/packages/stephenjude-filament-debugger)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

274326.6k8](/packages/croustibat-filament-jobs-monitor)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

284.5k1](/packages/finity-labs-fin-mail)

PHPackages © 2026

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