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.
Pros:
HasAttachments trait, aligning with Laravel’s ORM-first philosophy. This reduces boilerplate and leverages Laravel’s query builder, relationships, and events.AttachmentManager facade for direct file operations (upload, move, delete), abstracting filesystem logic from business layers.attachment.created, attachment.deleted) for hooks into workflows (e.g., notifications, analytics).Cons:
public disk and Glide’s cache directory, which may conflict with existing setups (e.g., S3, custom storage paths).filament-attachment-library), hinting at UI integration potential.attachments and directories tables. Assumes a relational database (MySQL, PostgreSQL, SQLite).files or media table, schema conflicts may arise.Attachment models) and service providers.glide:stats) and periodic cache clearing (glide:clear)..php files). Requires integration with Laravel’s Store or custom validation.media table) and potential duplication of effort.public disk) vs. cloud (S3, GCS). Cloud storage may need custom disk configuration.filament-attachment-library integration could streamline UI development.files/media tables or storage setups.composer require van-ons/laravel-attachment-library
php artisan attachment-library:install
Attachment model if needed (e.g., adding custom fields like uploaded_by).config/attachment-library.php.attachments table (write a custom migration or seeder).spatie/laravel-glide is installed and configured.attachment-library.php.HasAttachments trait to pilot models (e.g., User, Product).<x-laravel-attachment-library-image />).How can I help you explore Laravel packages today?