Search by

artisan-toolbox / filoquent

allanivp

Preview foundations for connecting Laravel's filesystem to Eloquent model attributes.

Package info

github.com/artisan-toolbox/filoquent

pkg:composer/artisan-toolbox/filoquent

Statistics

Installs: 17

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0-beta.3 2026-11-13 17:16 UTC

This package is auto-updated.

Last update: 2026-11-13 17:16:42 UTC


README

Filoquent

Beta PHP Laravel Tests Docs

File attributes for Eloquent with upload variants and indexed storage ownership.

Filoquent connects Laravel filesystems to Eloquent attributes. Assign an uploaded file, local path, or stream, then save the model. Middleware can produce named variants. An indexed ownership ledger coordinates replacement and permanent deletion.

Requires PHP ^8.5 and Laravel 13. Version 1.0.0-beta.2 is the published beta. APIs may change before the stable release. From your Laravel application's root, install the published version from Packagist:

composer require artisan-toolbox/filoquent:1.0.0-beta.2
php artisan migrate

Add a nullable JSON column using $table->filoquent('attachment')->nullable() and configure its model:

use ArtisanToolbox\Filoquent\Casts\AsFile;
use ArtisanToolbox\Filoquent\Concerns\HasFiloquent;
use Illuminate\Database\Eloquent\Model;

class Document extends Model
{
    use HasFiloquent;

    protected function casts(): array
    {
        return ['attachment' => AsFile::class];
    }
}

$source = storage_path('app/filoquent-example.txt');
file_put_contents($source, 'Hello Filoquent');

$document = new Document;
$document->attachment = $source;
$document->save();

dump($document->attachment->default()->exists());

The dump is true.

Run the installation guide to create the example table and configure writable storage. File metadata retains its saved disk and path across cast changes. Soft deletes retain files. The garbage collector reconciles committed receipts after manual row or column deletion. Optional Redis recovery tracks interrupted writes. Objects without a SQL receipt or Redis intent remain outside automatic discovery.

Read the documentation, contributing guide, security policy, changelog, and MIT license.