Download the PHP package oi-lab/oi-laravel-attachments without Composer

On this page you can find all versions of the php package oi-lab/oi-laravel-attachments. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package oi-laravel-attachments

OI Laravel Attachments BETA

Latest Version on Packagist Total Downloads Tests

A Laravel package for polymorphic file attachments. Attach files to any Eloquent model, organize them into named collections with ordering, store rich file metadata (EXIF, IPTC, dimensions, color profile), and group files into nested folders.

Features

How It Works

The package revolves around three models:

Host models opt in with the HasAttachments trait, which exposes the full attach / detach / sync / reorder API. All package internals resolve model classes through the OiLaravelAttachments resolver, so you can override any model from config without touching package code.

Requirements

Installation

The package auto-discovers and registers its service provider — no manual registration required.

Local Development

For local development, add this to your main project's composer.json:

Then:

Publish & Migrate

Publish the migrations (and optionally the config) and run them:

This creates the folders, files, and attachments tables.

Configuration

The config file config/oi-laravel-attachments.php exposes the following options:

Usage

Make a Model Attachable

Add the HasAttachments trait to any model:

Attach & Detach Files

Sync a Collection

syncAttachments() replaces every attachment in a collection. syncAttachmentsIfChanged() does the same but skips the database work when the ids and their order already match:

Reorder

Uploading Files

Use the action classes instead of building File records manually. StoreUploadedFile persists the upload and captures its metadata; AttachUploadedFiles stores many uploads and attaches them in a single call:

Working with Files

The File model offers type helpers, storage access, and a search scope:

File metadata is exposed as a value object rather than raw JSON:

Folders

Files can optionally be organized into a nested folder tree:

Customizing Models

To extend a model, subclass the package model and point the config at your class. Always resolve model classes through the OiLaravelAttachments helper so your override is respected everywhere:

Events

Each action dispatches a Laravel event you can listen to. All events live in OiLab\OiLaravelAttachments\Events:

Event Dispatched when
FileStored An uploaded file is stored by StoreUploadedFile
FileAttached A file is attached to a model
FileDetached One or more attachments are removed
AttachmentsSynced A collection is replaced via syncAttachments()
AttachmentsReordered Attachments are reordered
AttachmentCreated / AttachmentUpdated / AttachmentDeleted Model-level attachment lifecycle
FileCreated / FileUpdated / FileDeleted A file record is created, updated, or soft deleted
FileMoved A file is moved to a different folder
FileRestored A soft-deleted file is restored
FolderCreated / FolderUpdated / FolderDeleted A folder is created, updated, or soft deleted
FolderMoved A folder is moved to a different parent
FolderRestored A soft-deleted folder is restored

See the Events documentation for each event's payload and dispatch behaviour.

Database Schema

Table Purpose
folders Self-nesting folder tree (parent_id), soft-deletable
files Stored files with metadata, optional folder_id, soft-deletable
attachments Polymorphic pivot (attachable, file_id, collection, sort)

All three tables carry a unique uuid, created_by / updated_by audit columns, and timestamps.

Testing

This package ships 75 tests covering the attachment trait, models and relationships, sorting, upload actions, file metadata, audit tracking, and events.

AI Assistant Skills

This package ships a skill file that gives AI coding assistants (Claude Code, JetBrains Junie) context about how attachments work. Install it into your application with the Artisan command:

This writes .claude/skills/oilab-laravel-attachments/SKILL.md and .junie/skills/oilab-laravel-attachments/SKILL.md, and adds an oi-lab/oi-laravel-attachments rules section to your project's CLAUDE.md. See the documentation for details.

Contributing

Contributions are welcome! When contributing:

  1. Write tests for new features
  2. Ensure all tests pass: vendor/bin/pest
  3. Run vendor/bin/pint to match the project code style
  4. Update documentation as needed

License

This package is open-source software licensed under the MIT license.

Credits

Olivier Lacombe - Creator and maintainer

Olivier is a Product & Technology Director based in Montpellier, France, with over 20 years of experience innovating in UX/UI and emerging technologies. He specializes in guiding enterprises toward cutting-edge digital solutions, combining user-centered design with continuous optimization and artificial intelligence integration.

Projects & Resources:

Support

For support, please open an issue on the GitHub repository.


All versions of oi-laravel-attachments with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
league/flysystem Version ^3.0
spatie/laravel-data Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package oi-lab/oi-laravel-attachments contains the following files

Loading the files please wait ...