PHPackages                             filexus/filexus - 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. [Database &amp; ORM](/categories/database)
4. /
5. filexus/filexus

ActiveLibrary[Database &amp; ORM](/categories/database)

filexus/filexus
===============

Production-ready Laravel file attachment system for Eloquent models

1.1.0(1mo ago)210MITPHPPHP ^8.3CI passing

Since Mar 11Pushed 1mo agoCompare

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

READMEChangelogDependencies (12)Versions (6)Used By (0)

Filexus
=======

[](#filexus)

[![Latest Version on Packagist](https://camo.githubusercontent.com/776d1b7fafca8731375e9bf3b2b6aefffba98ee606f0783072fc88a450f60270/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66696c657875732f66696c657875732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/filexus/filexus)[![GitHub Tests Action Status](https://camo.githubusercontent.com/3a506aa76faf5d0b6e08cffbab8898ce9ae2f6a20b6630a4c0a5037dd4dfbfab/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f66696c657875732f66696c657875732f74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/filexus/filexus/actions/workflows/tests.yml)[![Total Downloads](https://camo.githubusercontent.com/60a2764d5d9518a86c54ac70fe58b19f371fe77caf6a152ebf9d9ac917d23899/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66696c657875732f66696c657875732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/filexus/filexus)[![Code Coverage](https://camo.githubusercontent.com/ab5c32de917933fa5f3400329933630c40768f0a9e437cf81f29c528bc463685/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f66696c657875732f66696c657875733f7374796c653d666c61742d737175617265)](https://codecov.io/gh/filexus/filexus)

A production-ready Laravel package that provides a simple and elegant file attachment system for Eloquent models. Attach files to any model with support for collections, single/multiple file modes, automatic cleanup, and more.

Features
--------

[](#features)

- ✨ Simple, fluent API for attaching files to models
- 📁 Named file collections (e.g., `avatar`, `gallery`, `documents`)
- 🔢 Single-file or multi-file collections
- 🗑️ Automatic file cleanup when models are deleted
- ⏰ File expiration support
- 🧹 Orphan file detection and pruning
- 🔐 SHA256 hash generation for deduplication
- 📊 Comprehensive metadata storage
- 🔍 Query scopes for efficient file lookups
- 🎨 Clean architecture with events and extensibility
- ✅ 100% test coverage with Pest PHP

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

[](#requirements)

- PHP 8.3+
- Laravel 11+

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

[](#installation)

Install the package via Composer:

```
composer require filexus/filexus
```

Publish the configuration file:

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

Publish and run the migrations:

```
php artisan vendor:publish --tag=filexus-migrations
php artisan migrate
```

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

[](#quick-start)

### 1. Add the Trait to Your Model

[](#1-add-the-trait-to-your-model)

```
use Illuminate\Database\Eloquent\Model;
use Filexus\Traits\HasFiles;

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

### 2. Attach Files

[](#2-attach-files)

```
// Attach a single file
$post->attach('thumbnail', $request->file('image'));

// Attach multiple files
$post->attachMany('gallery', $request->file('images'));
```

### 3. Retrieve Files

[](#3-retrieve-files)

```
// Get a single file from a collection
$thumbnail = $post->file('thumbnail');

// Get all files from a collection
$gallery = $post->files('gallery')->get();
```

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

[](#documentation)

For complete documentation, including configuration options, advanced usage, API reference, and examples, visit:

**🔗 **

The documentation includes:

- 📖 Getting Started Guide
- ⚙️ Configuration (global, primary keys, collections)
- 📝 Usage Examples (collections, metadata, expiration, pruning)
- 🔧 Advanced Topics (events, manager, scopes)
- 📚 API Reference (trait methods, File model, events)

Testing
-------

[](#testing)

```
composer test              # Run test suite
composer test-coverage     # Run with coverage report
composer analyse           # Run static analysis
```

Contributing
------------

[](#contributing)

Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker. Please see our [Security Policy](SECURITY.md) for more details.

Credits
-------

[](#credits)

- [John Michael Manlupig](https://github.com/avidianity)
- [All Contributors](https://github.com/filexus/filexus/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance96

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Every ~2 days

Total

5

Last Release

51d ago

PHP version history (2 changes)1.0.0PHP ^8.2

1.1.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/6ad23f13536a4c7738368a49d3dde93f118dd0b2e22276eeec62feee3ce2c939?d=identicon)[avidianity](/maintainers/avidianity)

---

Top Contributors

[![avidianity](https://avatars.githubusercontent.com/u/56546989?v=4)](https://github.com/avidianity "avidianity (18 commits)")

---

Tags

laraveleloquentfilesmediaattachmentsuploads

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/filexus-filexus/health.svg)

```
[![Health](https://phpackages.com/badges/filexus-filexus/health.svg)](https://phpackages.com/packages/filexus-filexus)
```

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k12.1M99](/packages/laravel-pulse)[watson/validating

Eloquent model validating trait.

9723.3M46](/packages/watson-validating)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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