Download the PHP package okamal/laravel-media-zone without Composer

On this page you can find all versions of the php package okamal/laravel-media-zone. 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 laravel-media-zone

# ๐ŸŽฏ Laravel Media Zone [![Latest Version on Packagist](https://img.shields.io/packagist/v/okamal/laravel-media-zone.svg?style=flat-square)](https://packagist.org/packages/okamal/laravel-media-zone) [![Total Downloads](https://img.shields.io/packagist/dt/okamal/laravel-media-zone.svg?style=flat-square)](https://packagist.org/packages/okamal/laravel-media-zone) [![License](https://img.shields.io/packagist/l/okamal/laravel-media-zone.svg?style=flat-square)](https://packagist.org/packages/okamal/laravel-media-zone) **Elegant polymorphic media management for Laravel + Inertia.js** *Organize uploads by zones. One trait. Beautiful Vue 3 component. Zero hassle.* [Features](#-features) โ€ข [Installation](#-installation) โ€ข [Quick Start](#-quick-start) โ€ข [Documentation](#-documentation)

โœจ Features


๐Ÿ“‹ Requirements

Package Version
PHP ^8.1, ^8.2, ^8.3, ^8.4
Laravel ^10.0, ^11.0, ^12.0
Inertia.js ^1.0 or ^2.0
Vue ^3.3, ^3.4, or ^3.5
Bootstrap ^5.3

Note: This package includes a Vue 3 component styled with Bootstrap 5.3. Make sure your project uses Bootstrap 5.3+.


๐Ÿš€ Installation

Step 1: Install Package

Step 2: Install Vue Dependency

Your project should already have vue, @inertiajs/vue3, and axios installed.

Step 3: Publish Assets

Publish configuration, migrations, and the Vue component:

Or publish individually:

Step 4: Run Migrations

Step 5: Link Storage

If you haven't already:

Step 6: Configure (Optional)

Review and customize config/media-zone.php if needed.


โšก Quick Start

1. Add Trait to Model

2. Use the Vue Component

The component is published to resources/js/Components/MediaZone/MediaZoneUpload.vue.

3. Save in Controller

4. Display Media

Add accessors to your model for easy access:

Display in your views:

That's it! ๐ŸŽ‰


๐Ÿ“š Documentation

Configuration

The configuration file is located at config/media-zone.php:


Component Props

Prop Type Default Required Description
label String '' No Label text above the file input
model String - Yes Full model class name (e.g., App\Models\Post)
zone String - Yes Zone identifier (e.g., avatar, gallery)
multiple Boolean false No Allow multiple file uploads
maxFiles Number null No Maximum number of files (only for multiple uploads)
accept String '*' No File type filter (e.g., image/*, .pdf)
inputError String '' No Validation error message
helperText String '' No Helper text below the input
uploadRoute String null No Custom upload endpoint
deleteRoute String null No Custom delete endpoint (use :id placeholder)

Example:


Trait Methods

Get Media

Sync & Attach

Check & Delete

Storage Paths


Media Model Attributes


Per-Model Validation

Create custom validation rules for specific models and zones.

Step 1: Create Config Class

Step 2: Register in Config

Now all uploads for Post model will use these custom rules! ๐ŸŽ‰


Maintenance Commands

Cleanup Temporary Files

Files uploaded but not attached to any model are automatically cleaned up:

Schedule Automatic Cleanup:

Add to app/Console/Kernel.php:


๐Ÿ’ก Usage Examples

Example 1: User Profile

Example 2: Product Gallery

Example 3: Document Uploads


๐ŸŽจ Styling

The Vue component is styled with Bootstrap 5.3 classes. Make sure your project includes Bootstrap 5.3+.

Using Bootstrap

If you're using Bootstrap via npm:

Custom Styling

The component uses slots, so you can customize the markup:


๐Ÿ”ง Advanced Usage

Custom Routes

Disable package routes and define your own:

Eager Loading

Prevent N+1 queries:

Custom Storage Paths

Override the storage path method in your model:


โ“ FAQ

Q: Do I need Bootstrap?
A: Yes, the Vue component uses Bootstrap 5.3 classes. A Tailwind version may be added in the future.

Q: Can I use this with React or Svelte?
A: Currently, only Vue 3 is supported. React/Svelte components may be added in future versions.

Q: Does this work with Laravel Livewire?
A: No, this package is specifically designed for Inertia.js.

Q: Can media be shared across multiple models?
A: Yes! The package uses a many-to-many polymorphic relationship, so the same media can be attached to multiple models.


๐Ÿ“ Changelog

See CHANGELOG.md for recent changes.


๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ”’ Security

If you discover a security vulnerability, please email [email protected]. All security vulnerabilities will be promptly addressed.


๐Ÿ“„ License

The MIT License (MIT). See LICENSE for details.


๐Ÿ’ Support

If this package saves you time:


๐Ÿ™ Credits

Inspired by the needs of the Laravel + Inertia.js community and the excellent work of packages like Spatie's Media Library.


๐Ÿ“ฌ Connect

Need custom Laravel development or want to hire me for your project? Get in touch!


**Made with โค๏ธ by [Omar Kamal](https://github.com/okamal)** If this package helps your project, please give it a โญ star! [โฌ† Back to Top](#-laravel-media-zone)

All versions of laravel-media-zone with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3|^8.4
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/routing Version ^10.0|^11.0|^12.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 okamal/laravel-media-zone contains the following files

Loading the files please wait ...