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(5y ago)19MITPHPPHP ^7.4|^8.0

Since May 18Pushed 5y 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 3w ago

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 35% 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

1870d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11057215?v=4)[Jure - Bernava Prah](/maintainers/jbernavaprah)[@jBernavaPrah](https://github.com/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

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M95](/packages/mongodb-laravel-mongodb)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M130](/packages/roots-acorn)[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k36.8M155](/packages/owen-it-laravel-auditing)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[prettus/l5-repository

Laravel 8|9|10|11|12|13 - Repositories to the database layer

4.3k11.3M157](/packages/prettus-l5-repository)

PHPackages © 2026

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