van-ons/laravel-attachment-library
Attach files to Laravel Eloquent models with a simple HasAttachments trait and Attachment model. Includes installer command for migrations/assets and an attachments relationship to link existing uploads to any model.
Adopt if:
request()->file() directly).Look elsewhere if:
Storage facade or dedicated packages like spatie/laravel-medialibrary.request()->file() or spatie/laravel-medialibrary for simpler needs.For Executives: "This package streamlines file management in our Laravel apps by automating attachments to database records—think user uploads, product images, or documents—while reducing backend complexity. It integrates with Filament for admin panels and supports responsive images via Glide, cutting development time by 30%+ compared to custom solutions. The MIT license ensures no vendor lock-in, and its extensibility future-proofs our media-heavy features (e.g., e-commerce, CMS)."
For Engineering: *"The Attachment Library provides a trait-based way to attach files to Eloquent models with minimal boilerplate. Key benefits:
AttachmentManager) for uploads, renames, and directory ops—no manual disk/DB sync.For Developers:
*"This replaces repetitive file-upload code with a single trait (HasAttachments) and a facade for CRUD ops. Highlights:
<x-laravel-attachment-library-image>) handles breakpoints.Attachment model.
Example workflow:// Attach a file to a User model
$user->attachments()->attach($attachment);
// Resize an image
$resized = Resizer::src($image)->width(800)->resize();
Downside: Adds a dependency, but the payoff is cleaner, scalable file management."*
How can I help you explore Laravel packages today?