PHPackages                             blax-software/laravel-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. blax-software/laravel-files

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

blax-software/laravel-files
===========================

Universal Laravel file management system — upload, optimize, serve, and attach files to any model.

010↓100%PHP

Since May 5Pushed 1mo agoCompare

[ Source](https://github.com/blax-software/laravel-files)[ Packagist](https://packagist.org/packages/blax-software/laravel-files)[ RSS](/packages/blax-software-laravel-files/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Blax Software OSS](https://raw.githubusercontent.com/blax-software/laravel-workkit/master/art/oss-initiative-banner.svg)](https://github.com/blax-software)

Laravel Files
=============

[](#laravel-files)

A universal, plug-and-play file management system for Laravel. Upload, optimize, serve, and attach files to any Eloquent model — with disk-agnostic storage, automatic image optimization, chunked uploads, and a built-in warehouse endpoint.

---

Features
--------

[](#features)

- **Attach files to any model** — polymorphic MorphToMany relationship via the `HasFiles` trait
- **Role-based attachments** — tag files as `avatar`, `gallery`, `document`, etc. using the `FileLinkType` enum or custom strings
- **Disk-agnostic** — works with any Laravel filesystem disk (local, S3, GCS, …)
- **Automatic image optimization** — on-the-fly resizing and WebP conversion via [spatie/image](https://github.com/spatie/image)
- **Chunked uploads** — upload large files in pieces with real-time progress broadcasting
- **Warehouse endpoint** — a single route that resolves and serves any file by UUID, encrypted ID, or asset path
- **UUID primary keys** — every file gets a unique, non-sequential identifier
- **Artisan cleanup** — remove orphaned files that are no longer attached to any model

---

Quick Start
-----------

[](#quick-start)

```
composer require blax-software/laravel-files
```

Publish the config and migrations:

```
php artisan vendor:publish --tag=files-config
php artisan vendor:publish --tag=files-migrations
php artisan migrate
```

Add the trait to any model:

```
use Blax\Files\Traits\HasFiles;

class User extends Model
{
    use HasFiles;
}
```

Attach a file:

```
use Blax\Files\Enums\FileLinkType;

$user = User::find(1);

// Upload and attach in one call
$file = $user->uploadFile($request->file('avatar'), as: FileLinkType::Avatar, replace: true);

// Get the avatar back
$avatar = $user->getAvatar();
echo $avatar->url;       // → /warehouse/019d8ab8-…
echo $avatar->size_human; // → "2.4 MB"
```

---

Documentation
-------------

[](#documentation)

GuideDescription[Installation](docs/installation.md)Requirements, installation, configuration[Attaching Files](docs/attaching-files.md)The `HasFiles` trait, roles, attach/detach, reordering[File Operations](docs/file-operations.md)Creating files, reading/writing contents, duplication, scopes[Uploading](docs/uploading.md)Single uploads, chunked uploads, progress events[Serving Files](docs/serving-files.md)The Warehouse, inline responses, downloads[Image Optimization](docs/image-optimization.md)On-the-fly resizing, WebP, quality control[Configuration](docs/configuration.md)Full reference for `config/files.php`[Artisan Commands](docs/artisan-commands.md)`files:cleanup` and maintenance---

Optional Dependencies
---------------------

[](#optional-dependencies)

PackagePurpose`spatie/image ^3.8`Image optimization and resizing`blax-software/laravel-roles`Access control on the warehouse endpoint`blax-software/laravel-websockets`Real-time chunk upload progress via WebSockets---

Testing
-------

[](#testing)

```
composer test
# or
./vendor/bin/phpunit
```

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE) for details.

---

Star History
------------

[](#star-history)

[    ![Star History Chart](https://camo.githubusercontent.com/457f7b711a7c7ee81f04305854a0f63099b5554ee6e86278f731d12c12d8f7d8/68747470733a2f2f6170692e737461722d686973746f72792e636f6d2f63686172743f7265706f733d626c61782d736f6674776172652f6c61726176656c2d66696c657326747970653d64617465266c6567656e643d746f702d6c656674) ](https://www.star-history.com/?repos=blax-software%2Flaravel-files&type=date&legend=top-left)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance61

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d548acfc3520e2f810e35cfb78230f885befda9fa26a3be42353723c48f991e?d=identicon)[blax-software](/maintainers/blax-software)

---

Top Contributors

[![justsomexanda](https://avatars.githubusercontent.com/u/48434066?v=4)](https://github.com/justsomexanda "justsomexanda (6 commits)")

### Embed Badge

![Health badge](/badges/blax-software-laravel-files/health.svg)

```
[![Health](https://phpackages.com/badges/blax-software-laravel-files/health.svg)](https://phpackages.com/packages/blax-software-laravel-files)
```

###  Alternatives

[glicer/sync-sftp

Sync local files with ftp server

212.7k](/packages/glicer-sync-sftp)[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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