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
Filament Attachment Library

Filament Attachment Library Laravel Package

van-ons/filament-attachment-library

Filament package for easy attachment uploading and browsing. Install via Composer, run the install command to set up migrations and assets, then extend your custom Filament theme's Tailwind config to render the templates correctly.

View on GitHub
Deep Wiki
Context7

Filament Attachment Library is a Laravel/Filament package for easy attachment uploading and browsing inside Filament admin panels. Install it via Composer, run the provided install command for migrations and assets, and register a custom Filament theme for correct TailwindCSS styling.

  • Attachment upload and browsing integrated into Filament.
  • One-command installation for migrations and assets.
  • TailwindCSS-based templates with custom theme support.
  • Simple Composer setup with documented Filament version compatibility.
Frequently asked questions about Filament Attachment Library
What Laravel and Filament versions does this package support?
The package requires Laravel 9+ and Filament 4.0 or 5.0 (depending on the version). Check the [compatibility docs](https://github.com/VanOns/filament-attachment-library/blob/main/docs/compatibility.md) for exact version mappings. Always verify compatibility before installing to avoid breaking changes.
How do I install and set up Filament Attachment Library?
Run `composer require van-ons/filament-attachment-library:^2.0` and then `php artisan filament-attachment-library:install` to handle migrations and assets. You’ll also need to create a custom Filament theme and extend `tailwind.config.js` to include the package’s Blade templates for styling.
Can I use a custom storage disk for attachments?
Yes, the package defaults to the `public` disk but allows overriding via `.env` with `ATTACHMENTS_DISK=disk_name`. It’s recommended to use a dedicated disk to avoid conflicts, especially for production environments with high attachment volumes.
Does this package support image processing (e.g., resizing, format conversion)?
Yes, it integrates with Glide for dynamic image processing. If your project doesn’t already use Glide, you’ll need to install it (`composer require spatie/laravel-medialibrary` or similar) and configure it in `glide.php`. This adds minimal overhead but enables features like on-the-fly resizing.
How do I associate attachments with Eloquent models?
The package uses Laravel’s morph-to-many relationship, so you can attach files to any model by defining a relationship like `public function attachments() { return $this->morphToMany(Attachment::class, 'attachable'); }`. The installer creates the necessary pivot table and migrations automatically.
Will this work with my existing Filament resources?
Yes, the package is designed to integrate seamlessly with Filament Resources and Forms. You can add attachment fields to your existing forms or create dedicated attachment resources. The UI is built using Filament’s component system, so it blends naturally with your admin panel.
Are there performance concerns with large numbers of attachments?
The package is optimized for scalability, but performance depends on your storage backend (e.g., S3 vs. local disk). For 10K+ files, consider using a dedicated disk like S3 with proper caching. The morph-to-many relationship is efficient, but query scopes (e.g., `whereHas`) should be used to limit loaded attachments.
How do I customize the UI or override default styles?
The package uses TailwindCSS, so you can override styles by extending the theme in your `theme.css` file. For deeper customization, you can publish the package’s views (`php artisan vendor:publish --tag=filament-attachment-library-views`) and modify the Blade templates directly.
What security measures are in place for file uploads?
The package validates file types and sizes via Filament’s built-in upload handlers. For additional security, configure allowed MIME types in `config/filament-attachment-library.php` and avoid dynamic `basePath` values in storage disks to prevent path traversal risks. Always use a dedicated disk for attachments.
Are there alternatives to this package for Filament file management?
Alternatives include `spatie/laravel-medialibrary` (more generic, not Filament-specific) or `filament/spatie-media-library-integration` (a Filament wrapper for Media Library). This package stands out for its tight Filament integration, installer command, and Glide support, making it ideal for Filament-centric projects.
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.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels