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
Livewire Media Selector

Livewire Media Selector Laravel Package

drpshtiwan/livewire-media-selector

A lightweight WordPress-style media selector for Laravel and Livewire. Browse, search, paginate, and upload files from your disks, with single or multi-select, drag-to-reorder, collections, soft deletes, and trait helpers for quick model integration.

View on GitHub
Deep Wiki
Context7

A lightweight, WordPress-style media selector for Laravel built on Livewire. Browse, search, paginate, and upload files from your Laravel disks, then pick single or multiple items with drag-to-reorder. Optional collections group media per feature, and trait helpers (attachMedia, syncMedia, getMediaUrl) speed up model integration.

  • Uploads with size, extension, and mime limits, plus a can_upload toggle
  • Single/multi selection with reorder and Livewire/browser events
  • Soft delete, restore, and optional trash tab for moderation
  • RTL support and English, Arabic, and Kurdish translations
  • Hover-revealed actions and a clear selection ring for better UX
Frequently asked questions about Livewire Media Selector
What is drpshtiwan/livewire-media-selector and when should I use it?
It is a Livewire-powered media selector for Laravel that works like the WordPress media library: browse, search, and paginate files on your Laravel disks, upload new ones, and pick a single item or several with drag-to-reorder. It ships with optional collections, soft deletes with a trash tab, trait helpers such as attachMedia and syncMedia, Livewire and browser events, and English, Arabic, and Kurdish translations with RTL support. It fits admin, CMS, and back-office screens where Livewire is already your UI layer, but it is a selector and uploader rather than a full digital asset manager.
How do I install livewire-media-selector in a Laravel app?
Install it with composer require drpshtiwan/livewire-media-selector, then publish the config, migration, views, assets, and language files using the vendor:publish commands documented on livewire-media.thejano.com. Run the migration to create the media table, make sure storage:link exists, and confirm the disk you want to use is configured in config/filesystems.php. After that, drop the Livewire component into a Blade view and bind it to a property on your own Livewire component.
Which Laravel, PHP, and Livewire versions are supported?
The README lists PHP 8.3 or higher, Laravel 10 through 12, and Livewire 3.3+ or 4.x, so check the composer.json constraints against your application before installing. Laravel 9 and Livewire 2 are not supported. Pin the package version in CI and rerun your integration tests whenever you upgrade Laravel, Livewire, or Tailwind, since the UI and event behavior can shift between major Livewire releases.
Does it work with Livewire 4 and a Tailwind-based admin panel?
Yes, the component targets Livewire admin surfaces and its views are styled with Tailwind, and it inherits your app's font-family so it blends into an existing layout. RTL is applied automatically for locales such as Arabic and Kurdish, with key positions flipped, and English, Arabic, and Kurdish/Sorani language files are publishable. If your admin panel does not use Tailwind, expect to restyle or recompile the published views.
How do I bind single or multiple selected media to my Eloquent model?
Bind the component with wire:model to a public property on your Livewire component; single-select mode returns one media item while multi-select mode returns an ordered set you persist yourself. Order in multi-select mode is controlled by drag-to-reorder. For Eloquent models, the provided trait helpers attachMedia, syncMedia, and getMediaUrl handle attachment and URL resolution so you do not rebuild that glue. Verify the exact payload shape your component receives, because stricter single-select payloads are still on the planned list.
How do I configure disks, directories, collections, and upload limits?
The publishable config controls the filesystem disk, target directory, collections, and upload limits such as maximum size, allowed extensions, and MIME types, plus a can_upload flag. Collections scope media per feature, for example gallery or avatars. Remote disks such as S3 work through Laravel's filesystem layer, but uploads are synchronous by default, so test large files, CDN URLs, and temporary URL behavior before depending on them. You can also pass the canUpload attribute on the component to disable the Upload tab entirely.
Can I disable the Upload tab or restrict who can upload?
Yes, set the can_upload config value to false or pass :canUpload="false" to the component to hide the Upload tab and block uploads. That is a UI-level switch, not a permission system, so pair it with your own authorization check when mounting the component. Upload limits on size, extension, and MIME type add a second layer of protection, but server-side validation in your app is still recommended.
Does it support soft deletes, trash, and restore for media?
Soft deletes are optional and configurable; when enabled, deleted media moves into a trash tab where it can be restored from the same UI. Version 3.0.0 tightened the scoped queries behind selection, delete, and restore actions. Folders, tags, favorites, bulk actions, and media editing are not included, so those moderation and organization workflows require custom work.
Does the component emit events I can listen to for uploads and selections?
It emits Livewire and browser events when media is uploaded, deleted, or selected, so listeners can refresh counters, reindex search, or sync related records. Consume them with Livewire's On attributes or standard browser event listeners in your Blade view. There is no built-in queue or webhook integration, so background processing such as thumbnails or virus scanning stays in your application. Wrapping the event contract in a small internal adapter keeps future package upgrades from rippling through your admin code.
How is authorization handled, and can I use Laravel policies?
Policy integration is still listed as planned, so the package does not enforce per-user, per-disk, or per-collection permissions out of the box. You gate who can mount the component, which disks and directories are exposed, and whether uploads are allowed, and you add scoped queries or filters where row-level visibility matters. Put your own policy checks and middleware around the component and treat the selector purely as a UI layer. Test the scoped queries in 3.0.0 against your permission model before rollout.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings