artisanpack-ui/media-library

Media library package for ArtisanPack UI

Maintainers

Package info

github.com/ArtisanPack-UI/media-library

pkg:composer/artisanpack-ui/media-library

Transparency log

Statistics

Installs: 86

Dependents: 0

Suggesters: 2

Stars: 0

Open Issues: 21

1.3.0 2026-07-08 21:50 UTC

README

Tests PHP Version Laravel Version

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

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 & Filtering - Search by name, filter by type, folder, or tag
  • ๐ŸŽฏ Drag & 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

  • โšก 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

  • 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

Install via Composer:

composer require artisanpack-ui/media-library

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

Livewire 4 Streaming Uploads

Real-time upload progress with automatic Livewire 3 fallback:

<livewire:media-upload-zone wire:stream="uploadProgress" />

Visual Editor Integration

Embed the MediaPicker in your CMS visual editor:

<livewire:media-picker
    context="featured-image"
    :allowed-types="['image']"
    :multi-select="false"
/>

Media Statistics Dashboard

Display KPI cards with sparklines:

<livewire:media-statistics
    :show-sparklines="true"
    :sparkline-days="30"
/>

Table Export

Export your media library to various formats:

<x-artisanpack-table-export
    :formats="['csv', 'xlsx', 'pdf']"
    filename="media-export"
/>

AI features

Media Library integrates with 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 key Agent What 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

  • Livewire โ€” the <livewire:media::media-edit> and <livewire:media::media-upload> 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

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".

Documentation

๐Ÿ“š Complete Documentation

Getting Started

Usage

Visual Editor Integration

Dashboard & Statistics

API & Integration

Reference

Testing

Run the test suite:

composer test

Contributing

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

Security

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

Credits

  • Jacob Martella
  • Intervention Image for image processing
  • PHP-FFMpeg for video processing

License

This package is proprietary software developed by ArtisanPack UI.