A modern, responsive file manager for Laravel using Livewire and Alpine.js. Features include:
- Drag and drop file uploads
- Folder management
- Grid and list views
- File previews
- Image thumbnails
- Copy sharing links
- File downloads
- PHP 8.2 or higher
- Laravel 10.0 or higher
- Livewire 3.0 or higher
- spatie/laravel-medialibrary 10.0 or higher
Caution
Please be sure to install, configure and run migrations of spatie/laravel-medialibrary package before continue. You can review the installation steps at spatie/laravel-medialibrary documentation.
- Install the package via composer:
composer require pavlovich4/livewire-filemanager- Publish and run the migrations:
php artisan vendor:publish --tag="livewire-filemanager-migrations"
php artisan migrate- Publish the config file:
php artisan vendor:publish --tag="livewire-filemanager-config"- Publish and configure the media library:
php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="medialibrary-config"Update config/media-library.php:
'custom_path_generators' => [
\Pavlovich4\LivewireFilemanager\Models\File::class => \Pavlovich4\LivewireFilemanager\Support\CustomPathGenerator::class,
// or
// 'model_morph_alias' => PathGenerator::class
],- Create the symbolic link for public storage:
php artisan storage:linkImportant
This package requires Tailwind CSS along with the @tailwindcss/aspect-ratio and @tailwindcss/forms plugins to be installed and configured in your project.
- Update your Tailwind CSS configuration in
tailwind.config.js:
module.exports = {
// ...
content: [
// ...
'./vendor/pavlovich4/livewire-filemanager/resources/views/**/*.blade.php',
],
// ...
plugins: [
// ...
require('@tailwindcss/forms'),
require('@tailwindcss/aspect-ratio'),
],
};- Add the file manager component to your layout:
<livewire:file-manager />
{{-- Or --}}
@livewire('file-manager')- Include the style blade directive in the head tag of your layout:
@livewireFileManagerStyle- Include the scripts directive at the end of your body:
@livewireFileManagerScript- Trigger the file manager from any element using the
data-trigger="filemanager"attribute:
<!-- Basic trigger -->
<button data-trigger="filemanager">Open File Manager</button>The package configuration file (config/livewire-filemanager.php) allows you to:
return [
// Storage disk to use (default: 'public')
'disk' => 'public',
// Media library configuration
'media' => [
'path_generator' => Pavlovich4\LivewireFilemanager\Support\CustomPathGenerator::class,
],
];- Drag and drop support
- Multiple file upload
- Progress indicator
- File type validation
- Size limits (configurable)
- Create folders
- Delete folders (with confirmation)
- Rename folders
- Nested folders
- Folder navigation
- Preview files
- Download files
- Delete files
- Rename files
- Copy share links
- File icons based on type
- Grid/List view toggle
- Breadcrumb navigation
- Responsive design
- Loading states
- Error handling
Please see CONTRIBUTING for details.
If you discover any security related issues, please email pavlovebiokou@gmail.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
