PHPackages                             rato-guras/media-library - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. rato-guras/media-library

ActiveLibrary[Image &amp; Media](/categories/media)

rato-guras/media-library
========================

Reusable Laravel media library extracted from production app workflows.

v1.0.0(3mo ago)00MITPHPPHP ^8.1

Since Mar 24Pushed 3mo agoCompare

[ Source](https://github.com/Surjal/rato-guras-media-library)[ Packagist](https://packagist.org/packages/rato-guras/media-library)[ RSS](/packages/rato-guras-media-library/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (8)Versions (2)Used By (0)

rato-guras/media-library
========================

[](#rato-gurasmedia-library)

A standalone, reusable Laravel media library package with upload, browser, picker, thumbnail, and model-attachment support.

Requirements
------------

[](#requirements)

- PHP: ^8.1
- Laravel: 10.x, 11.x, 12.x
- Intervention Image: ^3.9

Installation
------------

[](#installation)

```
composer require rato-guras/media-library
php artisan media-library:install
php artisan migrate
```

Features
--------

[](#features)

- Upload image, document, audio, video, and generic files
- Optional image optimization pipeline (WebP conversion)
- Thumbnail generation for images
- Folder-aware media organization
- Media browser/grid endpoints and Blade UI
- Reusable Blade media picker component
- URL import endpoint
- Soft delete + restore + force delete behavior
- Polymorphic model attachment via `HasMedia`

Auto Discovery
--------------

[](#auto-discovery)

The package is auto-discovered by Laravel via `composer.json`:

- Provider: `RatoGuras\\MediaLibrary\\MediaLibraryServiceProvider`
- Facade alias: `MediaLibrary`

Configuration
-------------

[](#configuration)

Publish config with install command or manually:

```
php artisan vendor:publish --tag=media-library-config
```

Config file: `config/media-library.php`

Key options:

- `disk`
- `route_prefix`
- `route_middleware`
- `upload_directory`
- `image_directory`
- `thumbnail_directory`
- `document_directory`
- `audio_directory`
- `video_directory`
- `file_directory`
- `max_file_size`
- `allowed_mime_types`
- `image_driver`
- `create_thumbnails`
- `thumbnail_width`
- `thumbnail_height`
- `convert_images_to_webp`

Routes
------

[](#routes)

All routes are prefixed by `config('media-library.route_prefix')` and use middleware from `config('media-library.route_middleware')`.

Named routes:

- `media-library.index`
- `media-library.grid`
- `media-library.picker`
- `media-library.upload`
- `media-library.upload-from-url`
- `media-library.folder.create`
- `media-library.folder.delete`
- `media-library.delete-by-collection`
- `media-library.move`
- `media-library.restore`
- `media-library.update`
- `media-library.destroy`

Blade Component
---------------

[](#blade-component)

Default alias: ``

Example:

```

```

Model Attachment
----------------

[](#model-attachment)

Use the trait:

```
use Illuminate\Database\Eloquent\Model;
use RatoGuras\MediaLibrary\Traits\HasMedia;

class Post extends Model
{
    use HasMedia;
}
```

Usage:

```
$post->attachMediaFromRequest('cover_image', ['collection' => 'cover']);
$all = $post->getMedia('cover');
$first = $post->getFirstMedia('cover');
$post->deleteMedia($mediaId);
$post->clearMedia('cover');
```

Image Driver Fallback
---------------------

[](#image-driver-fallback)

- Set `media-library.image_driver=imagick` to prefer Imagick.
- If Imagick is unavailable, the package automatically falls back to GD.
- Default driver is GD for broad compatibility (including Windows).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance82

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

94d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ee6b49c9b6bf725a071e59ccfa8c50ab96a0d8171309e2dd7f5cf7505384385?d=identicon)[Surjal](/maintainers/Surjal)

---

Top Contributors

[![Surjal](https://avatars.githubusercontent.com/u/159222105?v=4)](https://github.com/Surjal "Surjal (1 commits)")

---

Tags

laravelmediapickermedia libraryuploads

### Embed Badge

![Health badge](/badges/rato-guras-media-library/health.svg)

```
[![Health](https://phpackages.com/badges/rato-guras-media-library/health.svg)](https://phpackages.com/packages/rato-guras-media-library)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9742.3M121](/packages/roots-acorn)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M137](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M122](/packages/laravel-pulse)[laravel/ai

The official AI SDK for Laravel.

9782.1M162](/packages/laravel-ai)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
