jbernavaprah/eloquent-fs
Larablocks Analysis
jbernavaprah/eloquent-fs works with Laravel 8 (latest release 1.1.2, May 19, 2021), which reached end of life on Jan 24, 2023: no more fixes, even for security.
Recommendation checks
Not advisedNot advised: no release or commit in over 2 years.
- No release or commit in over 2 years
- Supports only Laravel 8, past end of life since Jan 24, 2023
- No release in the last 12 months (last: May 19, 2021)
- 0 downloads a month (needs 10,000)
- 1 GitHub star (needs 100)
State
Likely abandoned- No release or commit in over 2 years.
- Last stable release: May 19, 2021.
- No releases in the last 12 months.
- First released: May 18, 2021.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Dec 1, 2026.
| Install | |
|---|---|
composer require jbernavaprah/eloquent-fs |
|
| Latest Version: | 1.1.2 |
| PHP: | ^7.4|^8.0 |
| Laravel: | 8 |
| License: | MIT |
| Last Updated: | May 24, 2021 |
| Links: | GitHub · Packagist |
EloquentFS
A laravel/lumen filesystem wrapper that use eloquent as datastore, inspired by GridFS (MongoDB)
Attention: it's not production ready!
Attention 2: It's under development!
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:
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:
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:
Different Connection:
If you would to change the connection then on your AppServiceProvider::register() method add:
\JBernavaPrah\EloquentFS\EloquentFS::$connection = 'different_connection';
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:
Do a PR, Do all tests and I will be glad to merge it!
Missing implementations:
- The locking file with
flock(). - Need a performance review. A comparison with MongoDB will be super!
- Use in some production environments :D
- Need a testing review.
ftruncate()need to be implemented.
Related Packages
Maps Laravel and lumen Eloquent models to Elasticsearch types.
Nested attributes allow you to save attributes on associated records through the...
Make easy query builder / eloquent queries based on requests for API Response
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.1.2 | ^7.4| | ^8.0 | MIT | |
| 1.1.1 | ^7.4| | ^8.0 | MIT | |
| 1.1.0 | ^7.4| | ^8.0 | MIT | |
| 1.0.0 | ^7.4| | ^8.0 | MIT |