PHPackages                             jbernavaprah/eloquent-fs - 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. jbernavaprah/eloquent-fs

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

jbernavaprah/eloquent-fs
========================

A laravel/lumen FileSystem that use Eloquent as datastore, inspired by GridFS (MongoDB)

1.1.2(4y ago)19MITPHPPHP ^7.4|^8.0

Since May 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jBernavaPrah/eloquent-fs)[ Packagist](https://packagist.org/packages/jbernavaprah/eloquent-fs)[ RSS](/packages/jbernavaprah-eloquent-fs/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

EloquentFS
==========

[](#eloquentfs)

A laravel/lumen filesystem wrapper that use eloquent as datastore, inspired by GridFS (MongoDB)

### Attention: it's not production ready!

[](#attention-its-not-production-ready)

### Attention 2: It's under development!

[](#attention-2-its-under-development)

Install:
--------

[](#install)

```
composer install jbernavaprah/eloquent-fs
```

Then create the required tables on database with:

```
php artisan migrate
```

This will use the standard laravel migrations, therefore will be also used the default connection set on your project.

Basic usage:
------------

[](#basic-usage)

To use this wrapper, you need to prefix the paths with `efs://`. The path will be used as `id` of the file on database.

```
touch('efs://file.txt'); // file.txt will be ID of this file.
file_put_contents('efs://file.txt', "foobar\n");
echo file_get_contents('efs://file.txt'); // "foobar\n"
copy('efs://file.txt', 'efs://other_file.txt');
echo file_get_contents('efs://other_file.txt'); // "foobar\n"
unlink('efs://file.txt');
unlink('efs://other_file.txt');
```

### With eloquent model:

[](#with-eloquent-model)

You can also use directly the Eloquent Model shipped with EloquentFS.

```
use JBernavaPrah\EloquentFS\Models\FsFile;

$file = new FsFile();
$file->id = 'file.txt'; // if not provided, will generated as uuid

$file->write("foobar", $append=true); // 6

$file->read($offset =3, $length = 3); // "bar"
$file->read($offset =0, $length = 6); // "foobar"

$file->write("foobar", $append=true); // 6
$file->read(); // foobarfoobar

$file->delete(); // Delete
```

Deep configuration:
-------------------

[](#deep-configuration)

### Different Connection:

[](#different-connection)

If you would to change the connection then on your `AppServiceProvider::register()` method add:

```
\JBernavaPrah\EloquentFS\EloquentFS::$connection = 'different_connection';
```

### Disable Migrations:

[](#disable-migrations)

If you would to disable the migrations, the on your `AppServiceProvider::register()` method add:

```
\JBernavaPrah\EloquentFS\EloquentFS::$runMigrations = False;
```

Now you will be in charge to create and run the required migrations. You can see those migrations on `./database/migrations` path.

How to help:
------------

[](#how-to-help)

Do a PR, Do all tests and I will be glad to merge it!

Missing implementations:
------------------------

[](#missing-implementations)

1. The locking file with `flock()`.
2. Need a performance review. A comparison with MongoDB will be super!
3. Use in some production environments :D
4. Need a testing review.
5. `ftruncate()` need to be implemented.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity60

Established project with proven stability

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 ~0 days

Total

4

Last Release

1819d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab2df76b73b8d5ba7d31cf239416a177a9b29c0847442dfd4fa18bb4a1d4f559?d=identicon)[jbernavaprah](/maintainers/jbernavaprah)

---

Tags

filesystemlaraveleloquentGridFSgrid-fs

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jbernavaprah-eloquent-fs/health.svg)

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

###  Alternatives

[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k33.0M95](/packages/owen-it-laravel-auditing)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[dyrynda/laravel-model-uuid

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

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

PHPackages © 2026

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