PHPackages                             muhamad-selim/filament-s3-filemanager - 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. muhamad-selim/filament-s3-filemanager

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

muhamad-selim/filament-s3-filemanager
=====================================

A Filament plugin for S3 file management with file and folder selection support. Supports Filament v3 and v4.

v0.1.0(5mo ago)06MITPHPPHP ^8.2CI failing

Since Nov 28Pushed 1mo agoCompare

[ Source](https://github.com/MuhamadSelim/filament-s3-filemanager)[ Packagist](https://packagist.org/packages/muhamad-selim/filament-s3-filemanager)[ RSS](/packages/muhamad-selim-filament-s3-filemanager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (7)Versions (3)Used By (0)

Filament S3 File Manager
========================

[](#filament-s3-file-manager)

A Filament plugin for S3-compatible file management with file and folder selection support, built with Flysystem integration. Supports both FilamentPHP v3 and v4.

Features
--------

[](#features)

- 🗂️ **File and Folder Selection**: Select files, folders, or both
- 📁 **Folder Navigation**: Browse through S3 storage with breadcrumb navigation
- 🔍 **Search**: Search files across your S3 storage
- 👁️ **File Preview**: Preview images, videos, PDFs, and audio files
- 📤 **File Upload**: Upload files directly to S3 with progress tracking
- 🎨 **Grid &amp; List Views**: Switch between grid and list view modes
- 🔒 **Secure**: Presigned URLs for secure file access
- ⚡ **Caching**: Built-in caching for improved performance
- 🎯 **Flysystem Integration**: Works with any S3-compatible storage (AWS S3, DigitalOcean Spaces, etc.)
- ✏️ **File Operations**: Rename, move, copy, and delete files and folders
- 📂 **Folder Management**: Create new folders directly from the file browser
- 🗑️ **Bulk Operations**: Delete files and folders with confirmation
- 🔄 **Real-time Updates**: Automatic refresh after file operations

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

[](#installation)

### Via Composer

[](#via-composer)

```
composer require muhamad-selim/filament-s3-filemanager
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --tag=filament-s3-filemanager-config
```

### Publish Views (Optional)

[](#publish-views-optional)

If you want to customize the views:

```
php artisan vendor:publish --tag=filament-s3-filemanager-views
```

Configuration
-------------

[](#configuration)

### 1. Configure S3 Disk

[](#1-configure-s3-disk)

Make sure you have an S3-compatible disk configured in `config/filesystems.php`:

```
'disks' => [
    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
        'url' => env('AWS_URL'),
        'endpoint' => env('AWS_ENDPOINT'),
        'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
    ],
],
```

### 2. Environment Variables

[](#2-environment-variables)

Add these to your `.env` file:

```
FILAMENT_S3_FILEMANAGER_DISK=s3
FILAMENT_S3_FILEMANAGER_SELECTION_MODE=file
FILAMENT_S3_FILEMANAGER_URL_EXPIRATION=3600
FILAMENT_S3_FILEMANAGER_MAX_SIZE=2048000
FILAMENT_S3_FILEMANAGER_CACHE_ENABLED=true
FILAMENT_S3_FILEMANAGER_CACHE_TTL=300
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
use MuhamadSelim\FilamentS3Filemanager\Forms\Components\S3FileManager;

S3FileManager::make('file_path')
    ->label('Select File')
    ->disk('s3')
```

### File Selection Only

[](#file-selection-only)

```
S3FileManager::make('file_path')
    ->label('Select File')
    ->disk('s3')
    ->fileOnly()
```

### Folder Selection Only

[](#folder-selection-only)

```
S3FileManager::make('folder_path')
    ->label('Select Folder')
    ->disk('s3')
    ->folderOnly()
```

### Both File and Folder Selection

[](#both-file-and-folder-selection)

```
S3FileManager::make('path')
    ->label('Select File or Folder')
    ->disk('s3')
    ->fileOrFolder()
```

### Dynamic Disk Selection

[](#dynamic-disk-selection)

```
S3FileManager::make('file_path')
    ->label('Select File')
    ->disk(fn (Get $get) => $get('storage_disk') ?? 's3')
```

### Complete Example

[](#complete-example)

```
use Filament\Forms\Form;
use MuhamadSelim\FilamentS3Filemanager\Forms\Components\S3FileManager;

public function form(Form $form): Form
{
    return $form
        ->schema([
            S3FileManager::make('file_path')
                ->label('Select File')
                ->disk('s3')
                ->fileOnly()
                ->required()
                ->afterStateUpdated(function ($state, $set) {
                    if ($state) {
                        // Handle file selection
                        $set('file_name', basename($state));
                    }
                }),
        ]);
}
```

Selection Modes
---------------

[](#selection-modes)

The component supports three selection modes:

1. **File Only** (`fileOnly()`): Users can only select individual files
2. **Folder Only** (`folderOnly()`): Users can only select directories
3. **Both** (`fileOrFolder()`): Users can toggle between selecting files or folders

API Routes
----------

[](#api-routes)

The package registers the following API routes:

- `POST /api/s3-files/folder-contents` - List files and directories in a folder with pagination
- `POST /api/s3-files/preview-url` - Generate presigned URL for file preview
- `POST /api/s3-files/upload` - Upload file to S3
- `DELETE /api/s3-files/file` - Delete a file
- `DELETE /api/s3-files/folder` - Delete a folder and all its contents
- `POST /api/s3-files/rename-file` - Rename a file
- `POST /api/s3-files/rename-folder` - Rename a folder
- `POST /api/s3-files/move-file` - Move a file to a new location
- `POST /api/s3-files/move-folder` - Move a folder to a new location
- `POST /api/s3-files/copy-file` - Copy a file to a new location
- `POST /api/s3-files/copy-folder` - Copy a folder to a new location
- `POST /api/s3-files/create-folder` - Create a new folder

All routes are protected by authentication middleware and rate limiting.

Configuration Options
---------------------

[](#configuration-options)

### Default Disk

[](#default-disk)

Set the default S3 disk to use:

```
'default_disk' => 's3',
```

### Selection Mode

[](#selection-mode)

Set the default selection mode:

```
'default_selection_mode' => 'file', // 'file', 'folder', or 'both'
```

### Presigned URL Expiration

[](#presigned-url-expiration)

Set how long presigned URLs remain valid (in seconds):

```
'presigned_url_expiration' => 3600, // 1 hour
```

### Maximum File Size

[](#maximum-file-size)

Set the maximum file size for uploads (in KB):

```
'max_file_size' => 2048000, // 2GB
```

### Allowed Extensions

[](#allowed-extensions)

Configure which file extensions are allowed:

```
'allowed_extensions' => [
    'mp4', 'pdf', 'jpg', 'png', // etc.
],
```

File Operations
---------------

[](#file-operations)

The file browser includes comprehensive file management capabilities:

### Delete Operations

[](#delete-operations)

- Delete individual files
- Delete folders and all their contents
- Confirmation dialogs for safety

### Rename Operations

[](#rename-operations)

- Rename files and folders
- Validation to prevent duplicate names
- Real-time updates after renaming

### Move Operations

[](#move-operations)

- Move files to different folders
- Move folders with all contents
- Path validation and error handling

### Copy Operations

[](#copy-operations)

- Copy files to new locations
- Copy folders recursively
- Maintains original files

### Create Folder

[](#create-folder)

- Create new folders from the file browser
- Automatic navigation to new folder
- Validation for folder names

Testing
-------

[](#testing)

The package includes a comprehensive test suite using Pest. To run the tests:

```
# From the package directory
cd packages/muhamad-selim/filament-s3-filemanager
composer install
vendor/bin/pest

# Or from the main project root
php artisan test packages/muhamad-selim/filament-s3-filemanager/tests
```

### Test Structure

[](#test-structure)

- **Unit Tests**: Service provider registration and configuration
- **Feature Tests**:
    - S3StorageService: File operations, caching, error handling
    - S3FileBrowserController: API endpoints, authentication, validation
    - S3FileManager Component: Form component functionality
    - Integration: End-to-end workflows

### Test Coverage

[](#test-coverage)

The test suite covers:

- File upload, deletion, and metadata operations
- Presigned URL generation
- Folder structure listing and navigation
- File/folder selection modes
- Security (path sanitization, authentication)
- Error handling and retry logic
- Cache management

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.0+ or 12.0+
- Filament 3.2+ or 4.0+
- League Flysystem 3.0+
- League Flysystem AWS S3 V3 3.0+

Version Compatibility
---------------------

[](#version-compatibility)

This package supports multiple versions simultaneously:

- **FilamentPHP**: v3.2+ and v4.0+
- **Laravel**: v11.0+ and v12.0+

The same codebase works with both versions without requiring different branches or conditional code paths.

License
-------

[](#license)

MIT

Support
-------

[](#support)

For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/muhamad-selim/filament-s3-filemanager).

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance81

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

165d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13c78dec0af1fdbcf087d95e778bf60644f8aa73ee8cf10b116793d8ebb5314a?d=identicon)[MuhamadSelim](/maintainers/MuhamadSelim)

---

Top Contributors

[![MuhamadSelim](https://avatars.githubusercontent.com/u/3630936?v=4)](https://github.com/MuhamadSelim "MuhamadSelim (9 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/muhamad-selim-filament-s3-filemanager/health.svg)

```
[![Health](https://phpackages.com/badges/muhamad-selim-filament-s3-filemanager/health.svg)](https://phpackages.com/packages/muhamad-selim-filament-s3-filemanager)
```

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[sistemi-etime/flysystem-plugin-aws-s3-v3

AWS S3 plugin for Flysystem.

11154.2k1](/packages/sistemi-etime-flysystem-plugin-aws-s3-v3)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
