PHPackages                             laravel-admin/media-manager - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. laravel-admin/media-manager

ActiveLaravel-package[File &amp; Storage](/categories/file-storage)

laravel-admin/media-manager
===========================

Provides a model around the storage, gives you image styles and a admin to manage your media

v6.1.6(2mo ago)93.7k2MITPHPPHP ^8.1|^8.2CI failing

Since Sep 18Pushed 2w ago6 watchersCompare

[ Source](https://github.com/laravel-admin/media-manager)[ Packagist](https://packagist.org/packages/laravel-admin/media-manager)[ RSS](/packages/laravel-admin-media-manager/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (6)Versions (44)Used By (0)

Laravel-Media-Manager
=====================

[](#laravel-media-manager)

This package has 4 main goals:

- Provide an Eloquent model around your applications storage
- By implementing a trait on your models automaticly create a 1-n relation with the media model
- Create image styles for images and store or cache these
- Provide a Vue component to show and browse for media

> Note: This package is still under development. Using it on productions environments is on your own risk. Collaborations and tips are always welcome

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

[](#requirements)

This package is completely build on the philosofy of Laravel 5.3. It uses the 5.3 method to quickly upload files and a Vue components setup as in Laravel Elixir 6. Do not use this package for Laravel 5.2 or lower. The templates of the Vue components are completly build on Bootstrap 3.

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

[](#installation)

Require this package with Composer

```
composer require laravel-admin/media-manager

```

Add the ServiceProvider to the providers array in app/config/app.php

```
LaravelAdmin\MediaManager\MediaManagerProvider::class

```

If you want to edit the config or backend views you need to publish these resources to your application

```
php artisan vendor:publish

```

The package generates a migration file for the media model, so migrate your database to create the table.

```
php artisan migrate

```

To use the Vue components in your (admin) applications, require the javascript bootstrap file from your vendor folder in your app.js file.

```
require('../../../vendor/laravel-admin/media-manager/resources/js/bootstrap.js');

```

> Note: The javascript requires Dropzone to work, use the following statement to install it:

```
npm install dropzone --save-dev

```

Upload media
------------

[](#upload-media)

With the following code you can upload a file to your default storage and returns the created media model.

```
use LaravelAdmin\MediaManager\Upload;

$media = Upload::handle($request, 'file');
```

> Note: the first parameter of the handle method is the default Laravel Request object. The second parameter is the name of the submitted file.

It's possible to upload a file to another storage. This storage has to be a configured storage as in config/filesystems.php

```
$media = Upload::storage('s3')->handle($request, 'file');
```

> Note: The Eloquent model saves the storage in the database, so your application always knows where to find the uploaded file.

The Uploader uses a driver based system to add files to your storage and database. You can create your own drivers and add it to the media config, within upload/drivers. Your driver has to implement the following interface:

```
LaravelAdmin\Mediamanager\Contracts\UploadDriver

```

By default the package provides two drivers. The default for uploading files from your request and a second one 'url' to directly save files from an url. To change the driver, just do:

```
$media = Upload::with('url')->handle($request, 'http://domain.com/somefile.jpg');
```

You can also replace an existing model instead of create a new one.

```
$media = Upload::update($current_model)->handle($request, 'file');
```

Create a relation
-----------------

[](#create-a-relation)

If you want to create a relation between your model and the media model, you can do this simple to add a field to your table and add the MediaTrait to your model.

Create a migration and add the following:

```
$table->integer('media_id')->unsigned()->nullable();
$table->foreign('media_id')->references('id')->on('media')->onDelete('set null');
```

> Note: add -&gt;after('fieldname') to add the field at the position you want.

Now add the MediaTrait to your model

```
namespace App;

use Illuminate\Database\Eloquent\Model;
use LaravelAdmin\MediaManager\Traits\MediaTrait;

class Blog extends Model
{
	use MediaTrait;
```

The trait is based on the convention that the field you add in your database is called 'media\_id'. If you prefer another naming, or you have more than one field like a header, just add a relation manually to your model:

```
public function myfieldname()
{
	return $this->belongsTo(\LaravelAdmin\MediaManager\Models\Media::class);
}
```

Now the trait is integrated, for now there are two new methods available on your model

- mediaUrl
- imagestyle

### mediaUrl

[](#mediaurl)

The mediaUrl method directly returns the public url of the connected media on your model

```
$blog->mediaUrl();

```

> Note: As parameter it is possible to send a custom media field.

### imagestyle

[](#imagestyle)

The imagestyle receives the imagestyle you want and return directly the url of the style. As second parameter you can pass a custom relation instead of 'media'.

```
$blog->imagestyle('thumbnail');

```

###  Health Score

60

—

FairBetter than 98% of packages

Maintenance91

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~89 days

Recently: every ~168 days

Total

40

Last Release

74d ago

Major Versions

1.1.0 → 2.0.02016-12-16

2.0.1 → 3.0.02017-01-27

v3.0.18 → v4.0.02019-08-05

v4.0.1 → v5.0.02021-11-25

v5.0.2 → v6.0.02023-02-15

PHP version history (7 changes)1.0.0PHP ^5.6 || ^7.0

v4.0.0PHP ^7.0

v5.0.0PHP ^7.0||^8.0

v5.0.1PHP ^7.3|^8.0

v6.1.1PHP ^8.1

v6.1.2PHP ^8.2

v6.1.4PHP ^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/d5dbc6a29877ed65ea33c85a4e6c63c4b16d9150bd757880f1af18813eaa33d8?d=identicon)[marcoboom](/maintainers/marcoboom)

![](https://www.gravatar.com/avatar/23ea7fac7266de97a318215d5d5f814bb5aad10acededb9cae1557dd197e1c66?d=identicon)[basdebeer](/maintainers/basdebeer)

---

Top Contributors

[![marcoboom](https://avatars.githubusercontent.com/u/1839784?v=4)](https://github.com/marcoboom "marcoboom (17 commits)")[![martijngastkemper](https://avatars.githubusercontent.com/u/250662?v=4)](https://github.com/martijngastkemper "martijngastkemper (9 commits)")[![jakobbuis](https://avatars.githubusercontent.com/u/949674?v=4)](https://github.com/jakobbuis "jakobbuis (7 commits)")[![stephandebruin](https://avatars.githubusercontent.com/u/22237643?v=4)](https://github.com/stephandebruin "stephandebruin (4 commits)")[![Sjoerdjanssenen](https://avatars.githubusercontent.com/u/8407498?v=4)](https://github.com/Sjoerdjanssenen "Sjoerdjanssenen (2 commits)")[![harmenjanssen](https://avatars.githubusercontent.com/u/803176?v=4)](https://github.com/harmenjanssen "harmenjanssen (1 commits)")

### Embed Badge

![Health badge](/badges/laravel-admin-media-manager/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-admin-media-manager/health.svg)](https://phpackages.com/packages/laravel-admin-media-manager)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k532.1M2.5k](/packages/aws-aws-sdk-php)[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[backpack/crud

Quickly build admin interfaces using Laravel, Bootstrap and JavaScript.

3.4k3.6M217](/packages/backpack-crud)[bagisto/bagisto

Bagisto Laravel E-Commerce

27.6k169.0k9](/packages/bagisto-bagisto)[eveseat/web

SeAT Web Interface

2623.4k149](/packages/eveseat-web)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

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