laravel-enso/documentsmanager

This package is abandoned and no longer maintained. The author suggests using the laravel-enso/documents package instead.

Documents Manager for Laravel Enso

Maintainers

Package info

github.com/laravel-enso/documents

Type:plugin

pkg:composer/laravel-enso/documentsmanager

Statistics

Installs: 16 735

Dependents: 2

Suggesters: 0

Stars: 20

Open Issues: 0

5.4.6 2026-04-21 15:17 UTC

This package is auto-updated.

Last update: 2026-04-21 15:24:51 UTC


README

License Stable Downloads PHP Issues Merge Requests

Description

Documents adds polymorphic document attachments to Enso models.

The package stores uploaded documents through the Enso files layer, exposes document listing, upload, and delete endpoints, supports configurable deletion rules for related models, and can queue OCR for PDF documents whose owners implement the Ocrable contract.

It is meant for backoffice models that need a lightweight document vault with optional OCR processing.

Installation

Install the package:

composer require laravel-enso/documents

Run the package migrations:

php artisan migrate

Optional publish:

php artisan vendor:publish --tag=documents-config

Default configuration:

return [
    'deletableTimeLimit' => 60 * 60,
    'imageWidth' => 2048,
    'imageHeight' => 2048,
    'onDelete' => 'restrict',
    'loggableMorph' => [
        'documentable' => [],
    ],
    'queues' => [
        'ocr' => 'heavy',
    ],
];

Features

  • Polymorphic one-to-one and one-to-many document relations via the Documentable trait.
  • File attachment handling through laravel-enso/files.
  • Upload, list, and delete API under core.documents.
  • Configurable delete policy with restrict or cascade.
  • OCR dispatch for PDF documents whose owner implements Ocrable.

Usage

Add the trait to any model that should own documents:

use Illuminate\Database\Eloquent\Model;
use LaravelEnso\Documents\Traits\Documentable;

class Order extends Model
{
    use Documentable;
}

Available relations:

  • document()
  • documents()

If the owning model should trigger OCR for uploaded PDFs, implement LaravelEnso\Documents\Contracts\Ocrable.

API

HTTP routes

  • GET api/core/documents
  • POST api/core/documents
  • DELETE api/core/documents/{document}

Route names:

  • core.documents.index
  • core.documents.store
  • core.documents.destroy

Model surface

LaravelEnso\\Documents\\Models\\Document

Useful methods:

  • store(array $request, array $files)
  • scopeFor(array $params): Builder
  • scopeFilter(?string $search): Builder

Depends On

Required Enso packages:

Companion frontend package:

Contributions

are welcome. Pull requests are great, but issues are good too.

Thank you to all the people who already contributed to Enso!