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

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

afea/filament-media
===================

Media gallery module for the Afea Filament CMS package ecosystem: curated media items with an image, an optional file and rich notes.

v0.1.0(1mo ago)014↑445.5%MITPHPPHP ^8.4

Since Apr 21Pushed 1mo agoCompare

[ Source](https://github.com/AfeaSoftware/filament-media)[ Packagist](https://packagist.org/packages/afea/filament-media)[ RSS](/packages/afea-filament-media/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (12)Versions (2)Used By (0)

afea/filament-media
===================

[](#afeafilament-media)

Media gallery module for the Afea Filament CMS package ecosystem.

Ships:

- `MediaItem` model — title + description + rich note + **two media collections** (image + downloadable file) via Spatie
- Reorderable Filament v4 `MediaItemResource` with RichEditor (shares `afea-cms.rich_content.blocks`)
- `MediaPlugin` + `afea:install:media` installer

Pair this with [`afea/filament-files`](../filament-files) when you need:

- **`filament-media`** — curated press kit / gallery items (1 image + 1 optional downloadable) with rich editorial notes.
- **`filament-files`** — flat document/link lists grouped by a string `group`, no editorial metadata.

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

[](#installation)

```
composer require afea/filament-media
php artisan afea:install:media
```

Register in `AdminPanelProvider`:

```
->plugin(\Afea\Cms\Media\Filament\MediaPlugin::make())
```

Three common scenarios
----------------------

[](#three-common-scenarios)

### 1. Render a gallery on a Blade page

[](#1-render-a-gallery-on-a-blade-page)

```
use Afea\Cms\Media\Models\MediaItem;

$gallery = MediaItem::query()->active()->ordered()->get();

foreach ($gallery as $item) {
    $item->imageUrl('preview');  // thumbnail
    $item->imageUrl();            // original
    $item->fileUrl();             // optional downloadable
}
```

### 2. Private disk for gated press kits

[](#2-private-disk-for-gated-press-kits)

```
AFEA_MEDIA_DISK=s3-private
```

Both image and file collections move to the new disk. For signed URLs use `getFirstMedia('media/files')?->getTemporaryUrl(...)`.

### 3. Model override with a custom `featured` scope

[](#3-model-override-with-a-custom-featured-scope)

```
class MediaItem extends \Afea\Cms\Media\Models\MediaItem
{
    public function scopeFeatured($q)
    {
        return $q->active()->where('order', '
