Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Attachment Library

Laravel Attachment Library Laravel Package

van-ons/laravel-attachment-library

A Laravel library for attaching files to Eloquent models. Install via Composer, run the install command to add migrations and assets, then use the HasAttachments trait on any model to link and retrieve attachments through a simple relationship.

View on GitHub
Deep Wiki
Context7

Laravel Attachment Library is a package for attaching files to Eloquent models in Laravel applications. Add the HasAttachments trait to any model and link attachments through a simple relationship API, keeping file handling separate from your domain logic.

Install via Composer and run php artisan attachment-library:install to publish migrations and assets.

  • Trait-based integration — enable attachments on any Eloquent model
  • Simple relationship API — attach files with $model->attachments()->attach($attachment)
  • Artisan installer — migrations and assets set up in one command
  • Framework-native — built on Eloquent conventions
  • Documented — detailed usage guides in the docs folder
Frequently asked questions about Laravel Attachment Library
How do I install the Laravel Attachment Library?
Run composer require van-ons/laravel-attachment-library, then run php artisan attachment-library:install. The install command publishes the package migrations and assets so you can set up the attachments tables and related files.
How do I attach an uploaded file to an Eloquent model?
Add the HasAttachments trait to your Eloquent model, then load an existing Attachment model and call attachments()->attach($attachment) on your model. The package links the attachment record to the model through the attachments relationship.
Does Laravel Attachment Library work with any Eloquent model?
Yes, any Eloquent model can use the HasAttachments trait to gain an attachments relationship. The README shows linking an existing Attachment to a model with attachments()->attach, so you can associate uploads with models such as users, posts, or custom records.
Which Laravel versions are supported by van-ons/laravel-attachment-library?
The provided README does not list Laravel version constraints. Check the package's composer.json on Packagist or GitHub before installing to confirm compatibility with your Laravel version.
Can I store attachments on S3 instead of the public disk?
The package defaults to Laravel's public disk, but its storage layer is configurable. For S3 or other non-default disks, expect to adjust the package storage configuration and verify that upload, delete, and Glide image handling work with that disk.
How does image resizing work in Laravel Attachment Library?
It integrates with Laravel Glide to provide on-the-fly image manipulation such as resizing and cropping. That keeps dynamic image delivery out of your application code and relies on Glide caching to reduce repeated processing.
Does the package provide an admin UI for managing attachments?
No, there is no standalone admin UI for attachment management. The package integrates with Filament according to the evaluation, but teams still need to build their own interfaces for browsing, uploading, or organizing attachments.
Are attachments soft-deleted by default?
No. Attachments are hard-deleted by default, so soft deletes or archiving require custom logic in your application. Plan for this if you need recoverable file records.
How can I customize file naming or metadata extraction?
The package uses modular, configurable components such as file namers, metadata retrievers, and storage adapters. You can customize these via configuration instead of forking the core library, which helps tailor attachment behavior to your app.
Is Laravel Attachment Library safe to use in production?
The package is well-structured and Laravel-native, but it has low adoption with few GitHub stars and no listed dependents. Treat it as medium risk and validate edge cases, storage behavior, and performance under your expected load before relying on it in production.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections