PHPackages                             dot-env-it/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. dot-env-it/laravel-file-manager

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

dot-env-it/laravel-file-manager
===============================

Metronic 8 styled file manager for Laravel using Spatie Media Library.

v1.0.3(1mo ago)280↓100%MITPHPPHP ^8.2CI passing

Since Apr 25Pushed 4w agoCompare

[ Source](https://github.com/dot-env-it/laravel-file-manager)[ Packagist](https://packagist.org/packages/dot-env-it/laravel-file-manager)[ Fund](https://www.buymeacoffee.com/jagdish.j.ptl)[ Fund](https://paypal.me/jagdishjptl)[ RSS](/packages/dot-env-it-laravel-file-manager/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (3)Versions (6)Used By (0)

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

[](#laravel-file-manager)

  ![Laravel File Manager](https://camo.githubusercontent.com/d91da8bf6b36cb8a4c317f1ece34620c9cd8eac9d6d7056e38d6dd1de982d672/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c25323046696c652532304d616e616765722e706e673f7061747465726e3d746f706f677261706879267374796c653d7374796c655f3226666f6e7453697a653d3130307078266d643d312673686f7757617465726d61726b3d31267468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d646f742d656e762d69742532466c61726176656c2d66696c652d6d616e61676572266465736372697074696f6e3d4d6574726f6e69632b382b7374796c65642b66696c652b6d616e616765722b666f722b4c61726176656c2b7573696e672b5370617469652b4d656469612b4c6962726172792e26696d616765733d68747470732533412532462532467777772e7068702e6e6574253246696d616765732532466c6f676f732532466e65772d7068702d6c6f676f2e737667)[![Latest Stable Version](https://camo.githubusercontent.com/7c15807d1e0d420bbc4704c9c99234d6e9b5c0419588c86e8e4727d6ba02ec53/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646f742d656e762d69742f6c61726176656c2d66696c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dot-env-it/laravel-file-manager)[![Total Downloads](https://camo.githubusercontent.com/6fee2efb33e776acd962a9926f1fe535af0650c6fa50fd5efacd128c3c237a51/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646f742d656e762d69742f6c61726176656c2d66696c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dot-env-it/laravel-file-manager)[![License](https://camo.githubusercontent.com/45985c4928bfda67fd355075428ee823c36de530ba5d5c6844505a81773f3039/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646f742d656e762d69742f6c61726176656c2d66696c652d6d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dot-env-it/laravel-file-manager)

A professional Livewire-powered file management system for Laravel. Organize media into logical tiers and manage complex file relationships with ease.

---

✨ Features
----------

[](#-features)

- **Reactive UI:** Built with Livewire for a smooth, AJAX-driven experience.
- **Hierarchical Navigation:**
    - **Tier 1:** Category Folders (e.g., "Identification", "Certificates").
    - **Tier 2:** Record Folders (e.g., "User: Alice Smith" with item counts and total sizes).
    - **Tier 3:** Detailed File Grid (Support for PDF, Images, and Office docs).
- **Search:** Case-insensitive search across folders and files (PostgreSQL `ILIKE` ready).
- **Spatie Powered:** Built directly on top of [Spatie Media Library](https://spatie.be/docs/laravel-medialibrary).

🚀 Installation
--------------

[](#-installation)

Install via composer:

```
composer require dot-env-it/laravel-file-manager
```

Publish the config and translations:

```
php artisan vendor:publish --tag="file-manager-config"
php artisan vendor:publish --tag="file-manager-translations"
```

🛠️ Usage
--------

[](#️-usage)

### 1. Implement the Interface

[](#1-implement-the-interface)

Add the `FileManagerModelInterface` to your parent model (e.g., a **Company**, **Department**, or **User Group**) to define how sub-models are mapped.

To keep your models clean and compatible with the **Laravel File Manager**, add these methods to your `User` (or any related model). These methods provide the labels and keys the component uses to build the navigation you see on your Parent Model page.

### 2. The Parent Model (e.g., Company)

[](#2-the-parent-model-eg-company)

This model defines the "Tier 1" folders.

```
use DotEnvIt\FileManager\Interfaces\FileManagerModelInterface;

class Company extends Model implements FileManagerModelInterface
{
    /**
     * Define the "Tier 1" structure.
     * Maps a Model Class to a collection of IDs.
     */
    public function getFileManagerMap(): array
    {
        return [
            \App\Models\User::class => $this->users->pluck('id'),
            \App\Models\UserCertificate::class => $this->certificates->pluck('id'),
        ];
    }

    /**
     * The display name for the root folder in breadcrumbs.
     */
    public function getFileManagerLabel(): string
    {
        return $this->name;
    }
}
```

---

### 3. The Sub-Models (e.g., User, UserCertificate)

[](#3-the-sub-models-eg-user-usercertificate)

These models define the "Tier 2" folders and handle the actual file attachments.

```
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use DotEnvIt\FileManager\Interfaces\FileManagerModelInterface;

class User extends Model implements HasMedia, FileManagerModelInterface
{
    use InteractsWithMedia;

    /**
     * The name displayed on the folder card in Tier 2.
     */
    public function getFileManagerLabel(): string
    {
        return $this->full_name;
    }

    /**
     * Used when creating new records from the File Manager.
     * Points back to the parent ID (e.g., company_id).
     */
    public function getFileManagerForeignKey(): string
    {
        return 'company_id';
    }
}
```

### 4. UI Component

[](#4-ui-component)

Insert the component into your Blade template. It will automatically handle the navigation based on your map.

```

```

### Folder Size Formatting

[](#folder-size-formatting)

The component automatically handles byte formatting (KB, MB, GB) for folder summaries using internal helpers to ensure type safety in PHP 8.4+.

⚙️ Configuration
----------------

[](#️-configuration)

The `config/file-manager.php` is the central brain of the package. Here is how to configure it:

### 1. Global Model Definitions (`models`)

[](#1-global-model-definitions-models)

This section defines the "Tier 1" folders.

- **`title_column`**: The column used for folder names. Supports dot-notation for relationships (e.g., `user.name`).
- **`flat`**:
    - `false`: **Nested View** (Files grouped inside specific record folders).
    - `true`: **Gallery View** (All files from all records shown in one list).
- **`filters`**: Limit visibility to specific Spatie Media collections or custom JSON properties.

### 2. Contextual Grouping (`relationships`)

[](#2-contextual-grouping-relationships)

The "Deep Vault" logic. When viewing a parent model (like a **Company**), this closure defines which child models to pull files from when `getFileManagerMap` function is not defined in Parent model.

```
'relationships' => [
    \App\Models\Company::class => function ($company) {
        return [
            \App\Models\Company::class => [$company->id],
            \App\Models\User::class => [$company->users()->id],
            \App\Models\Certification::class => $company->certifications()->pluck('id'),
        ];
    },
],
```

### 3. Dynamic Forms (`forms`)

[](#3-dynamic-forms-forms)

Define upload forms without writing a single line of HTML.

- **`fields`**: Generates a modal form with `text`, `date`, `select`, or `textarea`.
- **`custom_property`**: Data is saved directly into the Spatie `media` table's `custom_properties` column instead of your model's table.

---

🌍 Localization (Languages)
--------------------------

[](#-localization-languages)

The package is fully translatable. You can customize every piece of text shown in the [File Manager](https://www.google.com/search?q=https://courtile.test/modules/matters/01kptcqwdb34qw6cmba18sqt66/show%3Fview%3Dfile-manager) UI.

### 1. Publishing Translations

[](#1-publishing-translations)

To modify the default English strings or add a new language, publish the language files:

```
php artisan vendor:publish --tag="file-manager-translations"
```

This will create `resources/lang/vendor/file-manager/{locale}/messages.php`.

### 2. Translating Model Names

[](#2-translating-model-names)

By default, the UI uses the Class name of your models. You can provide "Human Readable" names in the `models` array of your language file:

```
// resources/lang/vendor/file-manager/en/messages.php
// model name should be written as snake_case
'models' => [
    'user'             => 'Staff Member',
    'company'          => 'Firm',
    'company_certification'    => 'Diploma',
],
```

*The package automatically looks for the **snake\_case** version of your Model name.*

### 3. Core UI Strings

[](#3-core-ui-strings)

You can change standard labels to match your application's terminology:

- **`root_name`**: Changes the first breadcrumb (Default: "File Manager").
- **`record`**: Changes the folder subtext (Default: "1 Record").
- **`new`**: Changes the action button text (Default: "New").

---

📜 License
---------

[](#-license)

The MIT License (MIT). Please see License File for more information.

---

*Built with ❤️ by [Dot-Env-It](https://github.com/dot-env-it)*

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.8% 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

Every ~4 days

Total

4

Last Release

32d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e7c021b8f19406056e9a24ec8d268cec00f1a9d77bd72d8cc5cb0a6fbc6a178?d=identicon)[Jagdish-J-P](/maintainers/Jagdish-J-P)

---

Top Contributors

[![Jagdish-J-P](https://avatars.githubusercontent.com/u/20887370?v=4)](https://github.com/Jagdish-J-P "Jagdish-J-P (24 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

### Embed Badge

![Health badge](/badges/dot-env-it-laravel-file-manager/health.svg)

```
[![Health](https://phpackages.com/badges/dot-env-it-laravel-file-manager/health.svg)](https://phpackages.com/packages/dot-env-it-laravel-file-manager)
```

###  Alternatives

[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

719160.4k12](/packages/tallstackui-tallstackui)[livewire-filemanager/filemanager

A simple, friendly and practical Livewire filemanager for your applications

3619.3k1](/packages/livewire-filemanager-filemanager)[spatie/livewire-filepond

Upload files using Filepond in Livewire components

307543.6k5](/packages/spatie-livewire-filepond)[dasundev/livewire-dropzone

A Livewire Dropzone component for simple drag-and-drop file uploads.

22890.4k](/packages/dasundev-livewire-dropzone)[backpack/medialibrary-uploaders

Helper functions to save files with spatie media library

1382.8k](/packages/backpack-medialibrary-uploaders)

PHPackages © 2026

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