ssh521 / laravel-file-manager
A simple and elegant file manager for Laravel applications with drag & drop upload, folder management, and file preview capabilities.
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
pkg:composer/ssh521/laravel-file-manager
Requires
- php: ^8.2
- illuminate/support: ^11.0|^12.0
- laravel/framework: ^11.0|^12.0
Requires (Dev)
- orchestra/testbench: ^8.0|^9.0
- phpunit/phpunit: ^10.0|^11.0
This package is auto-updated.
Last update: 2025-12-30 06:05:05 UTC
README
A modern and elegant file manager for Laravel applications with drag & drop upload, folder management, and image preview capabilities built with Tailwind CSS 4.0.
π¦ GitHub Repository: https://github.com/ssh521/laravel-file-manager.git
Features
- π Folder Management: Create, delete, and navigate through directories with breadcrumb navigation
- π€ File Upload: Modern drag & drop interface with multi-file support
- πΌοΈ Image Preview: Real-time preview for image files with responsive sizing
- ποΈ File Operations: Batch delete files and folders with selection
- π Security: Advanced path traversal protection and configurable file restrictions
- π¨ Modern UI: Built with Tailwind CSS 4.0 for a clean, responsive interface
- π Authentication: Configurable middleware support (web, auth, admin)
- βοΈ Highly Configurable: Extensive configuration options for all aspects
- π Localization Ready: Easy to customize text and labels
- π± Mobile Responsive: Works perfectly on all device sizes
- β¨ No Dependencies: Self-contained with CDN assets (Tailwind CSS 4.0 + Font Awesome 6)
Screenshots
Modern Tailwind CSS 4.0 interface with drag & drop functionality, breadcrumb navigation, and real-time image previews.
Installation
You can install the package via composer:
composer require ssh521/laravel-file-manager
The package will automatically register itself using Laravel's package auto-discovery.
Publish Assets (Optional)
Publish the configuration file:
php artisan vendor:publish --tag=file-manager-config
Publish views for customization:
php artisan vendor:publish --tag=file-manager-views
Storage Setup
Make sure your storage is properly linked:
php artisan storage:link
Usage
Basic Usage
The file manager will be automatically available at /file-manager route.
You can also create a link to the file manager in your application:
<a href="{{ route('file-manager.index') }}" class="inline-flex items-center px-4 py-2 bg-blue-600 border border-transparent rounded-lg text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition-colors duration-200">
<i class="fas fa-folder-open mr-2"></i>
Open File Manager
</a>
Configuration
After publishing the configuration file, you can customize the behavior in config/file-manager.php:
return [ // Storage paths 'storage_path' => 'app/public', 'public_path' => 'storage', // Route configuration 'route' => [ 'prefix' => 'file-manager', 'name' => 'file-manager', 'middleware' => ['web', 'auth'], // Add authentication ], // UI configuration 'title' => 'File Manager', 'root_name' => 'Storage', 'back_route' => null, // Optional back button route 'back_text' => 'λμκ°κΈ°', // File upload configuration 'max_file_size' => 10240, // KB (10MB) 'allowed_mimes' => [], // Empty = allow all file types // Image file extensions for preview 'image_extensions' => ['jpg', 'jpeg', 'png', 'gif', 'svg', 'webp'], // Security settings 'forbidden_extensions' => ['php', 'js', 'html', 'htm'], 'folder_name_pattern' => '/^[a-zA-Z0-9\-_\s]+$/', // Feature toggles 'features' => [ 'upload' => true, 'create_folder' => true, 'delete' => true, 'rename' => false, // Not implemented yet 'move' => false, // Not implemented yet ], ];
Integration with Your Application
Add Navigation Link
// In your admin panel or navigation <a href="{{ route('file-manager.index') }}" class="flex items-center px-3 py-2 text-sm font-medium text-gray-700 rounded-lg hover:bg-gray-100 hover:text-gray-900 transition-colors duration-200"> <i class="fas fa-folder text-blue-600 mr-2"></i> File Manager </a>
Custom Back Button
Set the back route in your config:
'back_route' => 'admin.dashboard', 'back_text' => 'Back to Dashboard',
Middleware Protection
Configure authentication and authorization:
'route' => [ 'middleware' => ['web'], // Basic web routes // or 'middleware' => ['web', 'auth'], // Requires authentication // or 'middleware' => ['web', 'auth', 'admin'], // Requires authentication + admin role ],
Configuration Options
Storage Configuration
'storage_path' => 'app/public', // Laravel storage path 'public_path' => 'storage', // Public URL path
Route Configuration
'route' => [ 'prefix' => 'admin/files', // Custom URL prefix 'name' => 'admin.files', // Route name prefix 'middleware' => ['web', 'auth'], // Route middleware ],
File Upload Restrictions
'max_file_size' => 5120, // 5MB in KB 'allowed_mimes' => [ 'image/jpeg', 'image/png', 'application/pdf', ], 'forbidden_extensions' => ['php', 'exe', 'bat'],
UI Customization
'title' => 'My File Manager', 'root_name' => 'Files', 'back_route' => 'dashboard', 'back_text' => 'Go Back',
Security Features
- Path Traversal Protection: Prevents access outside storage directory
- File Type Restrictions: Configurable forbidden extensions
- CSRF Protection: All forms protected with CSRF tokens
- Folder Name Validation: Prevents malicious folder names
API Endpoints
The package provides these endpoints:
GET /file-manager- File manager interfacePOST /file-manager/upload- Upload filesPOST /file-manager/create-folder- Create new folderDELETE /file-manager/delete- Delete files/folders
Customization
Custom Views
Publish the views and modify them:
php artisan vendor:publish --tag=file-manager-views
Views will be published to resources/views/vendor/file-manager/
Custom Styling
The package uses Tailwind CSS 4.0 and Font Awesome 6 icons loaded via CDN. You can override styles by publishing the views and adding custom CSS, or by customizing the Tailwind classes directly.
Extending the Controller
You can extend the FileManagerController to add custom functionality:
<?php namespace App\Http\Controllers; use Ssh521\LaravelFileManager\Http\Controllers\FileManagerController as BaseController; class CustomFileManagerController extends BaseController { public function index(Request $request) { // Add custom logic return parent::index($request); } }
Requirements
- PHP ^8.2
- Laravel ^11.0|^12.0
- Modern browser with JavaScript enabled
- Tailwind CSS 4.0 (included via CDN)
- Font Awesome 6 (included via CDN)
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email ssh521@naver.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Changelog
v1.0.0
- π Initial release
- π Complete file management functionality (upload, create folders, delete)
- π¨ Modern Tailwind CSS 4.0 interface
- πΌοΈ Image preview with responsive sizing
- π Advanced security features (path traversal protection, file validation)
- π Configurable authentication middleware
- βοΈ Comprehensive configuration options
- π± Mobile-responsive design
- β¨ Self-contained with CDN assets (no external dependencies)
