PHPackages                             ssh521/laravel-file-manager - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. ssh521/laravel-file-manager

ActiveLibrary[File &amp; Storage](/categories/file-storage)

ssh521/laravel-file-manager
===========================

A simple and elegant file manager for Laravel applications with drag &amp; drop upload, folder management, and file preview capabilities.

v1.0.4(8mo ago)039↓50%MITBladePHP ^8.2

Since Aug 29Pushed 4mo agoCompare

[ Source](https://github.com/ssh521/laravel-file-manager)[ Packagist](https://packagist.org/packages/ssh521/laravel-file-manager)[ RSS](/packages/ssh521-laravel-file-manager/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

Laravel File Manager
====================

[](#laravel-file-manager)

[![Latest Version on Packagist](https://camo.githubusercontent.com/04fcc33e008b710ec0f6e4316b7df8c606e9d60b0c0e8cfa9042c1271a7d4102/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7373683532312f6c61726176656c2d66696c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ssh521/laravel-file-manager)[![Total Downloads](https://camo.githubusercontent.com/2126d0e5ee35f60a426218deedddecaa5a02b5beffb4777dc2e8f1fe8cbacc1b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7373683532312f6c61726176656c2d66696c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ssh521/laravel-file-manager)[![GitHub Tests Action Status](https://camo.githubusercontent.com/586d24e640cd1f6d79c6f16ac793489d381b5993d29ac2a6f3aebf3f0d61d98a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7373683532312f6c61726176656c2d66696c652d6d616e616765722f72756e2d74657374733f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/ssh521/laravel-file-manager/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/d7c3228b98ba377396af7f22b568444a3abf3c528c3e47bf49ffa27927556997/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7373683532312f6c61726176656c2d66696c652d6d616e616765722f6669782d7068702d636f64652d7374796c652d6973737565733f6c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/ssh521/laravel-file-manager/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)

A modern and elegant file manager for Laravel applications with drag &amp; drop upload, folder management, and image preview capabilities built with **Tailwind CSS 4.0**.

📦 **GitHub Repository**:

Features
--------

[](#features)

- 📁 **Folder Management**: Create, delete, and navigate through directories with breadcrumb navigation
- 📤 **File Upload**: Modern drag &amp; 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
-----------

[](#screenshots)

[![Laravel File Manager Interface](Screenshot.png)](Screenshot.png)

*Modern Tailwind CSS 4.0 interface with drag &amp; drop functionality, breadcrumb navigation, and real-time image previews.*

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

[](#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-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

[](#storage-setup)

Make sure your storage is properly linked:

```
php artisan storage:link
```

Usage
-----

[](#usage)

### Basic 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:

```

    Open File Manager

```

### Configuration

[](#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

[](#integration-with-your-application)

#### Add Navigation Link

[](#add-navigation-link)

```
// In your admin panel or navigation

     File Manager

```

#### Custom Back Button

[](#custom-back-button)

Set the back route in your config:

```
'back_route' => 'admin.dashboard',
'back_text' => 'Back to Dashboard',
```

#### Middleware Protection

[](#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
---------------------

[](#configuration-options)

### Storage Configuration

[](#storage-configuration)

```
'storage_path' => 'app/public',  // Laravel storage path
'public_path' => 'storage',      // Public URL path
```

### Route Configuration

[](#route-configuration)

```
'route' => [
    'prefix' => 'admin/files',       // Custom URL prefix
    'name' => 'admin.files',         // Route name prefix
    'middleware' => ['web', 'auth'], // Route middleware
],
```

### File Upload Restrictions

[](#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

[](#ui-customization)

```
'title' => 'My File Manager',
'root_name' => 'Files',
'back_route' => 'dashboard',
'back_text' => 'Go Back',
```

Security Features
-----------------

[](#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
-------------

[](#api-endpoints)

The package provides these endpoints:

- `GET /file-manager` - File manager interface
- `POST /file-manager/upload` - Upload files
- `POST /file-manager/create-folder` - Create new folder
- `DELETE /file-manager/delete` - Delete files/folders

Customization
-------------

[](#customization)

### Custom Views

[](#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

[](#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

[](#extending-the-controller)

You can extend the FileManagerController to add custom functionality:

```
