Download the PHP package carone/laravel-media without Composer

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

Carone Laravel Media Package

A comprehensive media management package for Laravel applications that provides a clean, facade-based API for handling various media types including images, videos, audio files, and documents.

Installation

Install the package via Composer:

Publish the configuration file:

Run the migrations:

Admin Panel

The package includes a beautiful admin interface for managing media files. Access it at /admin/media (configurable).

Features

Configuration

Configure the admin panel in config/media.php:

Access Control

The admin panel is protected by the management_middleware configuration:

⚠️ IMPORTANT: Public API

This package provides ONLY ONE public interface: the Media facade.

External projects should NEVER directly access internal classes like:

Always use the facade:

Basic Usage

All media operations are performed through the Media facade:

Configuration

Configure media types and settings in config/media.php:

Media Types

The package supports four media types:

Each type can be individually enabled/disabled in the configuration.

Tags

The package includes a flexible tagging system that allows you to organize and categorize your media files.

Uploading Media with Tags

Managing Tags

Tags are automatically created if they don't exist. The package handles:

Accessing Tags

Updating Tags

Configuration

Enable or disable tags in config/media.php:

When tags are disabled:

API Response Format

Public Search Endpoints (GET /api/media/search, GET /api/media/type/{type})

These public endpoints return a minimal, SEO-friendly format:

Public Response Fields:

Single Media Resource (GET /api/media/{id})

The detail endpoint returns complete information:

Paginated Results

Public browsing and search endpoints return simplified data:

Management endpoints return complete resource data:

Search Results

Media Serving

Path-Based URLs

Media files are served using clean, SEO-friendly path-based URLs:

The path corresponds directly to the file's location in storage, making URLs predictable and clean.

Thumbnails

Thumbnails are served by ID (since they can be on different disks):

URL Generation

The public search endpoints automatically generate these URLs:

Security

Error Handling

The facade will throw appropriate exceptions:

Testing

Run the package tests:

Package Architecture (Internal)

⚠️ WARNING: The following information is for package development only.

External projects should NEVER access these internal components directly. Always use the Media facade.

Internal Structure

Key Internal Components

Database Schema

The package creates the following tables:

media_resources

Stores all media files (images, videos, audio, documents)

media_tags

Stores tags that can be attached to media resources

media_resource_tag

Pivot table for many-to-many relationship between media and tags

License

This package is open-sourced software licensed under the MIT license.

Contributing

Please see CONTRIBUTING for details.

Changelog

Please see CHANGELOG for more information on what has changed recently.

A configurable media management package for Laravel applications. Easily handle media uploads, storage, and metadata (images, videos, audio, and documents) in your Laravel backend projects using clean, reusable Actions and the Strategy Pattern.

💡 Perfect for projects where you want consistent, reusable media logic across multiple Laravel apps.

Features


Installation

Require the package via Composer:

Laravel will auto-discover the service provider.

Configuration

Publish the configuration file (optional):

This creates a config/media.php file in your app.

Database Migration

Run the included migration to create the media_resources table

Table structure: (Required fields are marked with *)

Column Type Description
id* bigint Primary key
type* enum(image, video, audio, document) Type of media
source* enum(local, external) File source
file_name* string Original file name (with extension)
path string Local storage path
url string External URL (if any)
name* string Readable name
description text Description
date date Date
meta json Extra metadata
timestamps* — Created/updated time

Quick Start

Upload Media

Get Media

Delete Media

Serve Files

The package automatically provides routes for serving files:

API Endpoints

The package provides ready-to-use REST API endpoints:

Migration from Existing Controllers

Replace your existing controller logic with Actions:

Advanced Features

Custom Validation

Configure validation rules per media type:

Storage Configuration

Important: The main media disk is configured globally and cannot be overridden per upload. This ensures consistent, path-based media URLs. Thumbnails can still use custom disks.

Route Protection

The package provides separate public and protected routes:

Public Routes (no authentication required):

Protected Routes (authentication required by default):

Configure protection in config/media.php:

Error Handling

All Actions throw appropriate exceptions:

Image Processing Driver Setup

The package supports two image processing drivers: Imagick and GD. Choose based on your application's needs.

Driver Comparison

Feature Imagick GD
Installation Requires php-imagick extension Usually built-in with PHP
Memory Usage Streams data (~20-30 MB for 4000×4000) Loads full image (~180-200 MB for 4000×4000)
Large Images Handles efficiently Requires high memory_limit
Performance Generally faster Adequate for small images
Availability Needs separate installation Built into most PHP installs

Understanding Memory Behavior

Imagick processes images by streaming data in chunks:

GD loads the entire decompressed image into memory:

Which Driver to Choose?

Choose Imagick if:

Choose GD if:

Both drivers are fully supported. The package defaults to Imagick but will automatically fall back to GD if Imagick is not installed.

Installation

Ubuntu/Debian

Windows

  1. Download the appropriate DLL from PECL or windows.php.net
  2. Place it in your PHP ext directory (e.g., C:\php\ext\php_imagick.dll)
  3. Edit php.ini and add:

  4. Restart your web server

macOS

Then add to your php.ini:

Verification

After installation, verify your setup:

This will display:

Or check directly:

Configuration

The driver is configured in config/media.php:

To use GD:

Oversized Image Handling

The package can automatically scale down very large images to prevent memory issues and reduce storage:

When enabled:

Automatic Fallback

If Imagick is configured but not installed, the package will:

  1. Log a warning
  2. Automatically fall back to GD

Memory Recommendations

Recommended Settings

For applications handling large images, configure adequate memory:

Memory Requirements by Image Size

Image Size Minimum memory_limit Recommended
Up to 2000×2000 128M 256M
Up to 4000×4000 256M 512M
Larger than 4000×4000 512M+ 1G

Note: Imagick uses less memory than GD for the same images. With scale_oversized_images enabled, memory requirements are further reduced.

Check Your Settings

Run the info command to see your current configuration:

This will warn you if your memory limit is below the recommended 256M.

Troubleshooting

Error: "Imagick class not found"

Error: "Call to undefined function imagick_..."

Still getting memory errors with Imagick

Images look worse quality

Want to disable automatic scaling

Performance Comparison

Testing with a 4000×4000 JPEG (5 MB on disk):

Operation GD Imagick
Load image ~180 MB RAM ~25 MB RAM
Resize to 2560×2560 ~220 MB RAM ~30 MB RAM
Generate thumbnail ~250 MB RAM ~35 MB RAM
Total time 3.2s 1.8s

Results may vary based on server configuration and image complexity.

Summary

Both drivers work well for their intended use cases:

The package is configured to use Imagick by default but will work seamlessly with either driver.

Documentation

For detailed usage examples and advanced features, see USAGE.md.

Architecture

This package uses:

License

This package is open-sourced software licensed under the MIT license.

💬 About

carone/laravel-media is built for developers who need consistent, configurable media handling across multiple Laravel projects — without duplicating models, migrations, or upload logic.

Designed for backend efficiency.
Presentation is up to you. 🎨


All versions of laravel-media with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0
intervention/image-laravel Version ^1.5
illuminate/database Version ^12.0
carone/laravel-common Version ^1.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 carone/laravel-media contains the following files

Loading the files please wait ...