Download the PHP package codebyray/livewire-media-uploader without Composer

On this page you can find all versions of the php package codebyray/livewire-media-uploader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package livewire-media-uploader

media_uploader_screenshot

Livewire Media Uploader

tests

Livewire Media Uploader is a reusable Livewire v3/v4 component that integrates seamlessly with Spatie Laravel Media Library. It ships a clean Tailwind Blade view by default (fully publishable), Bootstrap theme as an option, Alpine overlays for previews/confirmations, drag-and-drop uploads, per-file metadata (caption/description/order), configurable presets, name-conflict strategies, and optional SHA-256 duplicate detection. Drop it in, point it at a model, and you’re shipping in minutes.


Table of Contents


Features


Requirements

Note on Laravel 10/11: Earlier releases of this package listed Laravel 10 and 11 as supported. Both are now past their security-support window (Laravel 10 is EOL; Laravel 11 security support ended March 2026), and current releases of laravel/framework in those lines carry known, unpatched advisories — meaning a fresh composer install targeting either will be blocked by Composer's own audit for most consumers. Support for both has been dropped as of v0.5.0. If you're still running Laravel 10/11, pin this package to v0.4.x, but prioritize upgrading Laravel first — that's the more urgent fix.

Every PHP/Laravel/Livewire combination listed above is verified on every push via GitHub Actions.


Installation

Auto-discovery will register the service provider. If you disable discovery, add:

The component is registered under both aliases:


Publishing Assets

Config:

Views:

After publishing, customize the Blade at:

Theme System (Tailwind + Bootstrap + custom)

Select the theme in config/media-uploader.php:

Dark mode (Tailwind theme)

This package’s Tailwind theme is dark-ready. Add this tiny snippet in your main layout <head> to apply the user’s saved choice / system default:

Custom themes

Notes


Quick Start

1) Ensure your target Eloquent model implements Spatie\MediaLibrary\HasMedia and is saved.

Model Setup (Spatie Media Library)

Your model must implement HasMedia and be saved before attaching media.

2) Include Livewire & Alpine (usually in your app layout):

3) Drop the component into your Blade:


Usage Examples

1) Pass a saved model instance

2) Short string model + id

3) Morph map alias**

4) FQCN

5) Dotted path + custom namespaces

6) Local aliases (per-instance)

7) Single-file mode + hide list

8) Name conflict strategies

9) Duplicate detection by SHA-256

10) Restrict types/mimes/max size manually

Create flow (deferred uploads)

You can let users pick files before the model exists, and attach them after save.

Blade (create page)

Livewire component (simplified)

How it works

Configuration

The package merges config/media-uploader.php:

Example:

Show all collections together (grouped) Set :list-all="true" to render a grouped list of every collection on the target model. Items stay fully editable.

The component decides the active preset in this order:

  1. Explicit $preset prop
  2. Mapping from collections
  3. Fallback to default

Props

Prop Type Default Description
for Model Saved Eloquent model instance implementing HasMedia.
model string Model resolver: alias, FQCN, morph alias, or dotted path.
id int|string Target model id (used with model).
collection string images Media collection name.
disk ?string null Storage disk (e.g. s3).
multiple bool true Toggle multi-file input.
accept ?string null <input accept> override (otherwise may be auto from config).
showList bool true Show the attached media list.
maxSizeKb int 500 (overridden to preset’s max_kb if empty) Max file size (KB).
preset ?string null Choose a preset (images, docs, videos, default, etc.).
allowedTypes array [] Extensions filter (e.g. ['jpg','png']).
allowedMimes array [] MIME filter (e.g. ['image/jpeg']).
onNameConflict string rename Strategy: rename | replace | skip | allow.
skipExactDuplicates bool false Uses SHA-256 stored in custom_properties->sha256.
namespaces array ['App\\Models'] Namespaces for dotted-path resolution.
aliases array [] Local alias map, e.g. ['profile' => \App\Models\User::class].
attachedFilesTitle string "Current gallery" Heading text in the list card.
listAll bool false When true, the attached media list shows all collections, grouped by collection name (still editable).
authorizeAbility ?string null Gate/Policy ability checked against the target model before upload/delete/edit/attach. See Authorization.

Events

The component dispatches browser events you can listen for:

Example:


Authorization

By default, the component does not perform any authorization. It verifies that a given Media record belongs to the resolved target model before allowing edits/deletes, but it does not check whether the current user is allowed to modify that model. It's your app's responsibility to ensure the component only renders where the user already has access (route middleware, a policy check before rendering the page, etc.).

If you'd like the component to enforce this itself, set authorizeAbility to a Gate/Policy ability name. It's checked against the resolved target model before every mutating action (uploadFiles, remove, saveEdit, and the media:attach event handler), using Laravel's own Gate::authorize() — no extra package required, and it plays nicely with anything already wired up (Policies, Gate closures, Spatie Permissions via a Gate, etc.).

With the example above, before any upload/delete/edit/attach action runs, the component calls the equivalent of Gate::authorize('update', $post). If your PostPolicy::update() returns false, the action aborts with a 403 instead of proceeding.

Notes:


The list view tries getUrl('thumb') and falls back to getUrl() if no conversion is available.


Overlays & UX Notes


Troubleshooting


Roadmap

PRs welcome!


License

MIT © CodebyRay (Ray Cuzzart II)


Component aliases: media-uploader and media.media-uploader
View namespace: media-uploader::livewire.media-uploader


All versions of livewire-media-uploader with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
livewire/livewire Version ^3.0 || ^4.0
laravel/framework Version ^12.0 || ^13.0
spatie/laravel-medialibrary Version ^10.12 || ^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package codebyray/livewire-media-uploader contains the following files

Loading the files please wait ...