PHPackages                             artisanpack-ui/media-library - 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. artisanpack-ui/media-library

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

artisanpack-ui/media-library
============================

Media library package for ArtisanPack UI

1.4.0(4w ago)0247[21 issues](https://github.com/ArtisanPack-UI/media-library/issues)MITPHPPHP ^8.2CI passing

Since Nov 3Pushed 4w agoCompare

[ Source](https://github.com/ArtisanPack-UI/media-library)[ Packagist](https://packagist.org/packages/artisanpack-ui/media-library)[ RSS](/packages/artisanpack-ui-media-library/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (9)Dependencies (127)Versions (17)Used By (0)

ArtisanPack UI Media Library
============================

[](#artisanpack-ui-media-library)

![Tests](https://camo.githubusercontent.com/d940ad7f0752e2cbe0d63c50dcebf329078807390051c41fe63258f1b5c4e182/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d70617373696e672d627269676874677265656e)![PHP Version](https://camo.githubusercontent.com/4f0ff8d47b7c73441eb92a1f49af61c2d6521b14113c8fd85fac4416c863e7cc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e322d626c7565)![Laravel Version](https://camo.githubusercontent.com/2facef7cbf1f3217a1e07cf192baacb92824d1247d93db353c2866b6b9cb842f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d313225323025374325323031332d726564)

A comprehensive media management package for Laravel applications with support for image processing, folder organization, tagging, and modern image format conversion (WebP/AVIF).

Features
--------

[](#features)

### Core Features

[](#core-features)

- 📁 **Hierarchical Folder Organization** - Organize media into nested folders
- 🏷️ **Tag Management** - Tag media items for easy categorization
- 🖼️ **Image Processing** - Automatic thumbnail generation in multiple sizes
- 🚀 **Modern Image Formats** - Automatic conversion to WebP and AVIF
- 📦 **Storage Abstraction** - Support for multiple storage backends via Laravel's filesystem
- 🎬 **Video Support** - Video thumbnail extraction using FFmpeg (optional)
- 🔍 **Advanced Search &amp; Filtering** - Search by name, filter by type, folder, or tag
- 🎯 **Drag &amp; Drop Upload** - Modern upload interface with progress tracking
- 🖱️ **Media Modal Component** - Single/multi-select modal for choosing media with context support
- 🔐 **Permission-based Access Control** - Granular capability-based permissions
- 🎨 **Publishable Views** - Customize all Blade views to match your design
- 🧪 **Comprehensive Test Coverage** - Over 500 tests with 90%+ coverage

### New in v1.1

[](#new-in-v11)

- ⚡ **Livewire 4 Streaming Uploads** - Real-time upload progress with `wire:stream` (automatic fallback for Livewire 3)
- 📊 **Media Statistics Dashboard** - KPI cards with sparklines showing upload trends, storage usage, and type distribution
- 📤 **Table Export** - Export media library data to CSV, XLSX, or PDF formats
- 🪟 **Glass Effects** - Modern glassmorphism UI with customizable blur and transparency
- 🧩 **Visual Editor Integration** - MediaPicker component for CMS visual editors with block content helpers
- ⌨️ **Keyboard Navigation** - Full keyboard support for media selection (arrow keys, Enter, Escape)
- 🕐 **Recently Used Media** - Quick access to recently selected media items
- ⚙️ **Feature Flags** - Granular control over features via configuration

Requirements
------------

[](#requirements)

- PHP 8.2 or higher (PHP 8.3+ required when using Laravel 13)
- Laravel 12.0 or 13.0
- Intervention Image 3.0 for image processing
- FFmpeg (optional, for video thumbnail extraction)

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

[](#installation)

Install via Composer:

```
composer require artisanpack-ui/media-library
```

Quick Start
-----------

[](#quick-start)

```
// Upload media
$media = apUploadMedia($file, [
    'title' => 'My Image',
    'alt_text' => 'Alt text for accessibility',
    'folder_id' => 1,
]);

// Get media URL
$url = apGetMediaUrl($mediaId, 'thumbnail');

// Display image
$media = apGetMedia($mediaId);
echo $media->displayImage('large', ['class' => 'img-fluid']);
```

What's New in v1.1
------------------

[](#whats-new-in-v11)

### Livewire 4 Streaming Uploads

[](#livewire-4-streaming-uploads)

Real-time upload progress with automatic Livewire 3 fallback:

```

```

### Visual Editor Integration

[](#visual-editor-integration)

Embed the MediaPicker in your CMS visual editor:

```

```

### Media Statistics Dashboard

[](#media-statistics-dashboard)

Display KPI cards with sparklines:

```

```

### Table Export

[](#table-export)

Export your media library to various formats:

```

```

AI features
-----------

[](#ai-features)

Media Library integrates with [`artisanpack-ui/ai`](https://github.com/ArtisanPack-UI/ai) to offer three vision-powered helpers for image media items. Each feature is toggled through the ai package's feature registry (`config('artisanpack.ai.features.*')` or the AI settings admin surface).

Feature keyAgentWhat it does`ai.alt_text``ArtisanPackUI\Ai\Agents\AltTextGenerationAgent` (ships in `artisanpack-ui/ai`)Suggests accessibility-friendly alt text for an image.`media.suggest_tags``ArtisanPackUI\MediaLibrary\Ai\Agents\ImageTagSuggestionAgent`Picks matching tags from the existing `media_tags` taxonomy (opt-in new tags).`media.image_description``ArtisanPackUI\MediaLibrary\Ai\Agents\ImageDescriptionAgent`Produces a paragraph-length image description for galleries, portfolios, etc.### Surfaces

[](#surfaces)

- **Livewire** — the `` and `` components gain "AI suggest" buttons next to the alt-text, description, and tag fields. Buttons hide themselves when the feature is disabled or `artisanpack-ui/ai` is absent.
- **React** — the shipped `MediaEdit.tsx` component wires "Suggest with AI" and "Describe with AI" buttons around the alt-text, description, and tag fields. `resources/js/react/utils/api.ts` exports typed helpers (`suggestMediaAltText`, `suggestMediaTags`, `suggestMediaDescription`). AI is post-upload only in React/Vue because the JSON endpoints require a persisted media item — the Livewire `MediaUpload` supports pre-upload suggestions by handing the AI agent a `TemporaryUploadedFile` directly.
- **Vue** — the shipped `MediaEdit.vue` component mirrors the React wiring. The same helpers are exported from `resources/js/vue/utils/api.ts`.
- **Any HTTP client** — all three features are exposed as JSON endpoints under the existing `api/media` prefix. Roll your own client if you're not using our React/Vue components:

    ```
    POST /api/media/{id}/ai/alt-text                       -> { data: { alt_text, confidence, warnings } }
    POST /api/media/{id}/ai/tags       { allow_new: bool } -> { data: { tags[], new_tags[], confidence } }
    POST /api/media/{id}/ai/description { length: "short" | "medium" | "long" } -> { data: { description, confidence, warnings } }

    ```

    Each endpoint enforces the `update` policy on the media item and returns `403` when the feature is disabled, `422` when the target media isn't an image, and `503` when no AI credentials are configured.

### Enabling the features

[](#enabling-the-features)

`artisanpack-ui/ai` is a required dependency starting in v1.3. Configure credentials via `config/artisanpack.php` or the "AI → Settings" admin page and toggle individual features from "AI → Features".

Pipeline hooks
--------------

[](#pipeline-hooks)

Media Library exposes the full media pipeline through [`artisanpack-ui/hooks`](https://github.com/ArtisanPack-UI/hooks) so applications can intercept upload, processing, thumbnail, and delete lifecycle events without subclassing the shipped services. Register subscribers with `addAction()` / `addFilter()` from a service provider.

HookTypeFires fromPayload`ap.mediaLibrary.uploading`action`MediaUploadService::upload()` start`(UploadedFile $file, array $options)``ap.mediaLibrary.uploadOptions`filterBefore the `Media` record is persisted`(array $options, UploadedFile $file)``ap.mediaLibrary.uploaded`actionAfter the `Media` record is created and tags attached`(Media $media)``ap.mediaLibrary.filenameGenerated`filter`MediaUploadService::generateFileName()``(string $filename, UploadedFile $file)``ap.mediaLibrary.allowedMimeTypes`filterEvery read of the allowed MIME allow-list`(array $mimes)``ap.mediaLibrary.maxFileSize`filterEvery read of the max upload size (KB)`(int $sizeKb, ?Authenticatable $user)``ap.mediaLibrary.storageDisk`filter`MediaStorageService::resolveDisk()``(string $disk, ?Media $media)``ap.mediaLibrary.beforeProcess`action`MediaProcessingService::processImage()` start`(Media $media)``ap.mediaLibrary.imageSizes`filterBefore the thumbnail generation loop`(array $sizes, ?Media $media)``ap.mediaLibrary.thumbnailsGenerated`action`MediaProcessingService::generateThumbnails()` end`(Media $media, array $urls)``ap.mediaLibrary.beforeDelete`actionEloquent `deleting` event on `Media``(Media $media)``ap.mediaLibrary.deleted`actionEloquent `deleted` event on `Media``(Media $media)``ap.mediaLibrary.altTextSuggestion`filterAI alt-text seam (`MediaEdit`, `MediaAiController`)`(?string $suggestion, Media $media)`Example — cap uploads at 2 MB for guests and route enterprise-tier accounts to a dedicated disk:

```
addFilter( 'ap.mediaLibrary.maxFileSize', function ( int $size, $user ): int {
    return $user?->onEnterprisePlan() ? $size : 2048;
} );

addFilter( 'ap.mediaLibrary.storageDisk', function ( string $disk, ?Media $media ) use ( $tenantResolver ): string {
    return $tenantResolver->diskFor( $media?->uploaded_by ) ?? $disk;
} );
```

Filters must return a value; actions do not. See [`artisanpack-ui/hooks`](https://github.com/ArtisanPack-UI/hooks) for priority ordering, removal semantics, and Facade / Blade usage.

Documentation
-------------

[](#documentation)

📚 **[Complete Documentation](docs/home.md)**

### Getting Started

[](#getting-started)

- **[Quick Start](docs/getting-started.md)** - Get up and running quickly
- **[Installation](docs/installation/installation.md)** - Detailed installation instructions
- **[Configuration](docs/installation/configuration.md)** - All configuration options
- **[Upgrading to v1.1](docs/upgrading.md)** - Migration guide from v1.0.x

### Usage

[](#usage)

- **[Helper Functions](docs/usage/helper-functions.md)** - Common usage patterns
- **[Working with Models](docs/usage/models.md)** - Advanced model usage
- **[Livewire Components](docs/usage/livewire-components.md)** - UI component guide
- **[Streaming Uploads](docs/usage/streaming-uploads.md)** - Livewire 4 real-time upload progress
- **[Table Export](docs/usage/table-export.md)** - Export media data to CSV/XLSX/PDF
- **[AI Features](docs/usage/ai-features.md)** - Alt text, tag suggestions, image descriptions (v1.3)

### Visual Editor Integration

[](#visual-editor-integration-1)

- **[MediaPicker Component](docs/visual-editor/media-picker.md)** - Visual editor media selection
- **[Block Content Helpers](docs/visual-editor/block-helpers.md)** - Block content integration
- **[Integration Examples](docs/visual-editor/examples.md)** - Complete integration examples

### Dashboard &amp; Statistics

[](#dashboard--statistics)

- **[Media Statistics](docs/dashboard/statistics.md)** - KPI cards and sparklines
- **[Glass Effects](docs/dashboard/glass-effects.md)** - Glassmorphism UI customization

### API &amp; Integration

[](#api--integration)

- **[API Reference](docs/api/endpoints.md)** - Complete API documentation
- **[CMS Integration](docs/integration/cms-module.md)** - Digital Shopfront CMS setup
- **[Permissions](docs/integration/permissions.md)** - Access control guide
- **[Customization](docs/integration/customization.md)** - Customization options

### Reference

[](#reference)

- **[Troubleshooting](docs/reference/troubleshooting.md)** - Common issues and solutions
- **[FAQ](docs/reference/faq.md)** - Frequently asked questions
- **[Changelog](CHANGELOG.md)** - Version history

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

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

[](#contributing)

Contributions are welcome! Please ensure all tests pass and code follows ArtisanPack UI Code Standards.

Security
--------

[](#security)

If you discover a security vulnerability, please send an email to .

Credits
-------

[](#credits)

- [Jacob Martella](https://github.com/jacobmartella)
- Intervention Image for image processing
- PHP-FFMpeg for video processing

License
-------

[](#license)

This package is proprietary software developed by ArtisanPack UI.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance94

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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

Recently: every ~25 days

Total

9

Last Release

28d ago

### Community

Maintainers

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

---

Top Contributors

[![ViewFromTheBox](https://avatars.githubusercontent.com/u/8247489?v=4)](https://github.com/ViewFromTheBox "ViewFromTheBox (74 commits)")

---

Tags

file-uploadimage-managementlaravellaravel-packagelivewiremedia-librarymedia-managerphp

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/artisanpack-ui-media-library/health.svg)

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

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.8k2.5k](/packages/unopim-unopim)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1239.7k25](/packages/fleetbase-core-api)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.8k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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