PHPackages                             s-webs/s-files - 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. s-webs/s-files

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

s-webs/s-files
==============

File manager for Laravel projects

v1.0.14(3mo ago)040MITPHPPHP ^8.2

Since Jan 22Pushed 3mo agoCompare

[ Source](https://github.com/s-webs/s-files)[ Packagist](https://packagist.org/packages/s-webs/s-files)[ RSS](/packages/s-webs-s-files/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (16)Used By (0)

S-Files - Universal File Manager for Laravel
============================================

[](#s-files---universal-file-manager-for-laravel)

A modern, universal file manager for Laravel with a beautiful interface, drag &amp; drop support, file preview, and many other features.

> **Note:** For Russian documentation, see [README.ru.md](README.ru.md)

Features
--------

[](#features)

- 🎨 Modern interface built with Alpine.js and Tailwind CSS
- 📁 File and folder management
- 📤 File upload via drag &amp; drop
- 👁️ Preview for images, PDFs, and documents
- 🔒 Optional authentication (can be disabled)
- 🚀 Rate limiting to prevent abuse
- 🔐 Secure path and file validation
- 📦 Support for various storage disks
- 🎯 Fully customizable

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

[](#requirements)

- PHP &gt;= 8.2
- Laravel &gt;= 10.0 or &gt;= 11.0 or &gt;= 12.0
- Node.js &gt;= 18.0 and npm (for building assets)
- Vite (for building frontend resources)

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

[](#installation)

### Via Composer

[](#via-composer)

```
composer require s-webs/s-files
```

### Publish Configuration

[](#publish-configuration)

```
php artisan vendor:publish --tag=sfiles-config
```

### Publish Views (Optional, for customization)

[](#publish-views-optional-for-customization)

```
php artisan vendor:publish --tag=sfiles-views
```

### Publish Assets (Optional, for customization)

[](#publish-assets-optional-for-customization)

```
php artisan vendor:publish --tag=sfiles-assets
```

### Install npm Dependencies

[](#install-npm-dependencies)

The package requires the following npm dependencies:

- `alpinejs` (^3.15.4) - for interface reactivity
- `dropzone` (^6.0.0-beta.2) - for drag &amp; drop file uploads
- `compressorjs` (^1.2.1) - for image compression before upload

**Option 1: Install in root project (recommended)**

If you're using the package in your project, install dependencies in the root `package.json`:

```
npm install alpinejs@^3.15.4 dropzone@^6.0.0-beta.2 compressorjs@^1.2.1
```

**Option 2: Install in package (for development)**

If you're developing the package locally:

```
cd vendor/s-webs/s-files
npm install
```

### Configure Vite

[](#configure-vite)

The package **CSS is loaded automatically** (standalone, no Vite). You only need to add the **JS** entry to `vite.config.js`:

```
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import tailwindcss from '@tailwindcss/vite';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'resources/css/app.css',
                'resources/js/app.js',
                // S-Files: add only the JS (CSS is standalone)
                'vendor/s-webs/s-files/resources/js/filemanager.js',
            ],
            refresh: true,
        }),
        tailwindcss(),
    ],
});
```

**If you develop the package locally** (e.g. in `packages/s-webs/s-files`), use: `packages/s-webs/s-files/resources/js/filemanager.js`

### Build Assets

[](#build-assets)

After configuring Vite, build the assets:

```
# For development (with hot reload)
npm run dev

# For production
npm run build
```

**Important:** Make sure the Vite dev server is running (`npm run dev`) during development, or build the assets (`npm run build`) for production.

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

[](#configuration)

### 1. Configuration File

[](#1-configuration-file)

Open the `config/sfiles.php` file and configure the parameters:

```
// Storage disk for files
'disk' => env('SFILES_DISK', 'uploads'),

// Public directory prefix
'public_dir' => env('SFILES_PUBLIC_DIR', 'uploads'),

// Route prefix
'routes' => [
    'prefix' => env('SFILES_ROUTE_PREFIX', 's-files'),
    'middleware' => ['web'],
],

// Authentication (optional)
'auth' => [
    'enabled' => env('SFILES_AUTH_ENABLED', false), // false = no authentication
    'middleware' => env('SFILES_AUTH_MIDDLEWARE', 'auth'),
],
```

### 2. Storage Configuration

[](#2-storage-configuration)

Make sure the files disk is configured in `config/filesystems.php`:

```
'disks' => [
    'uploads' => [
        'driver' => 'local',
        'root' => storage_path('app/uploads'),
        'url' => env('APP_URL').'/uploads',
        'visibility' => 'public',
    ],
],
```

And create a symbolic link:

```
php artisan storage:link
```

### 3. Environment Variables (.env)

[](#3-environment-variables-env)

```
# Storage disk
SFILES_DISK=uploads

# Public directory
SFILES_PUBLIC_DIR=uploads

# Route prefix
SFILES_ROUTE_PREFIX=s-files

# Authentication (true/false)
SFILES_AUTH_ENABLED=false

# Middleware for authentication (if enabled = true)
SFILES_AUTH_MIDDLEWARE=auth

# Maximum file size in KB (default 10MB)
SFILES_MAX_SIZE=10240

# Rate limiting
SFILES_RATE_LIMIT_UPLOAD=100
SFILES_RATE_LIMIT_DELETE=30
SFILES_RATE_LIMIT_GENERAL=60
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

After installation, the file manager will be available at:

```
http://your-app.test/s-files

```

Or at your configured prefix.

### With Authentication

[](#with-authentication)

If you want to protect the file manager with authentication:

1. Set `SFILES_AUTH_ENABLED=true` in `.env`
2. Configure `SFILES_AUTH_MIDDLEWARE` (e.g., `auth` for standard Laravel authentication)

### Without Authentication

[](#without-authentication)

By default, authentication is disabled (`SFILES_AUTH_ENABLED=false`). The file manager will be accessible to everyone.

**⚠️ Warning:** Use without authentication only in secure environments or protect routes at the web server level.

### MoonShine Integration

[](#moonshine-integration)

If you're using MoonShine and want to integrate the file manager:

1. Create a custom middleware for MoonShine authentication
2. Set `SFILES_AUTH_ENABLED=true`
3. Configure `SFILES_AUTH_MIDDLEWARE` to your custom middleware

Example middleware:

```
