cleaniquecoders / media-manager
Spatie Media Library Manager
Fund package maintenance!
Cleanique Coders
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/cleaniquecoders/media-manager
Requires
- php: ^8.4
- illuminate/contracts: ^11.0||^12.0
- livewire/livewire: ^3.0 || ^4.0
- spatie/laravel-medialibrary: ^11.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
README
A Laravel package that provides a complete media management solution built on top of Spatie Media Library. Manage your media files through a modern, user-friendly interface with Livewire components.
Features
- Full-featured media browser with grid and list views
- Drag-and-drop file uploads with progress tracking
- Media collection management with reordering support
- Media picker for selecting existing files
- Search, filter, and bulk operations
- Custom properties and metadata support
- Authorization via Laravel gates
- Fully customizable views
Screenshots
Media Browser
Browse all your media files with filtering, searching, and bulk operations.
Media Uploader
Upload files to any model with drag-and-drop support.
Media Collection
Manage media collections inline with drag-and-drop reordering.
Installation
Install the package via Composer:
composer require cleaniquecoders/media-manager
Run the install command:
php artisan media-manager:install
Or manually publish and run migrations:
php artisan vendor:publish --tag="media-manager-migrations"
php artisan migrate
Optionally publish the config file:
php artisan vendor:publish --tag="media-manager-config"
Quick Start
1. Add the trait to your model
<?php namespace App\Models; use CleaniqueCoders\MediaManager\Concerns\HasMediaManager; use Illuminate\Database\Eloquent\Model; use Spatie\MediaLibrary\HasMedia; class Post extends Model implements HasMedia { use HasMediaManager; public function registerMediaCollections(): void { $this->addMediaCollection('featured')->singleFile(); $this->addMediaCollection('gallery'); } }
2. Add components to your views
{{-- Media Browser - embed in your own view with your layout --}} <livewire:media-manager::browser /> {{-- Media Uploader --}} <livewire:media-manager::uploader :model="$post" collection="gallery" :max-files="10" /> {{-- Media Collection Editor --}} <livewire:media-manager::collection :model="$post" collection="gallery" sortable /> {{-- Media Picker --}} <livewire:media-manager::picker wire:model="selectedMediaIds" multiple />
3. Create a route for the media browser
Create your own route and view to display the browser:
// routes/web.php Route::get('/media', function () { return view('media'); })->middleware(['web', 'auth']);
{{-- resources/views/media.blade.php --}} <x-app-layout> <livewire:media-manager::browser /> </x-app-layout>
Using the Facade
use CleaniqueCoders\MediaManager\Facades\MediaManager; // Upload files MediaManager::upload($model, $file, 'collection'); MediaManager::uploadMultiple($model, $files, 'collection'); // Browse with filters $media = MediaManager::browse(['collection' => 'gallery'], perPage: 24); // Delete media MediaManager::delete($media); MediaManager::deleteMultiple([1, 2, 3]);
Documentation
For detailed documentation, see the docs directory:
- Getting Started - Installation and setup
- Components - All Livewire components
- Configuration - Configuration options
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.


