PHPackages                             wutaophp/laravel-mediable - 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. [Database &amp; ORM](/categories/database)
4. /
5. wutaophp/laravel-mediable

ActiveLibrary[Database &amp; ORM](/categories/database)

wutaophp/laravel-mediable
=========================

A package for easily uploading and attaching media files to models with Laravel

2.0.4(3y ago)079MITPHPPHP &gt;=7.3.0|^8.0

Since Jun 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/imwutao/laravel-mediable)[ Packagist](https://packagist.org/packages/wutaophp/laravel-mediable)[ RSS](/packages/wutaophp-laravel-mediable/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (18)Versions (14)Used By (0)

Laravel-Mediable
================

[](#laravel-mediable)

[![Coveralls](https://camo.githubusercontent.com/11ddc5c633d78efcd17c6c5f9714b88ee22866161020e788edc674ac5b6dd46d/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f706c616e6b2f6c61726176656c2d6d65646961626c652e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/github/plank/laravel-mediable)[![StyleCI](https://camo.githubusercontent.com/78fca46bce0e07ba22824bb811f77008e84d44433ff40d64a7d481b6ef5dde5a/68747470733a2f2f7374796c6563692e696f2f7265706f732f36333739313131302f736869656c64)](https://styleci.io/repos/63791110)[![Packagist](https://camo.githubusercontent.com/787cdafc9ecbe4328b9978c908c75fbe02cb2cd6f9cbfd50dc8f70b28682a523/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706c616e6b2f6c61726176656c2d6d65646961626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/plank/laravel-mediable)

Laravel-Mediable is a package for easily uploading and attaching media files to models with Laravel.

Features
--------

[](#features)

- Filesystem-driven approach is easily configurable to allow any number of upload directories with different accessibility. Easily restrict uploads by MIME type, extension and/or aggregate type (e.g. `image` for JPEG, PNG or GIF).
- Many-to-many polymorphic relationships allow any number of media to be assigned to any number of other models without any need to modify their schema.
- Attach media to models with tags, in order to set and retrieve media for specific purposes, such as `'thumbnail'`, `'featured image'`, `'gallery'` or `'download'`.
- Integrated support for integration/image for manipulating image files to create variants for different use cases.

Example Usage
-------------

[](#example-usage)

Upload a file to the server, and place it in a directory on the filesystem disk named "uploads". This will create a Media record that can be used to refer to the file.

```
$media = MediaUploader::fromSource($request->file('thumb'))
	->toDestination('uploads', 'blog/thumbnails')
	->upload();
```

Attach the Media to another eloquent model with one or more tags defining their relationship.

```
$post = Post::create($this->request->input());
$post->attachMedia($media, ['thumbnail']);
```

Retrieve the media from the model by its tag(s).

```
$post->getMedia('thumbnail')->first()->getUrl();
```

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

[](#installation)

Add the package to your Laravel app using composer

```
composer require plank/laravel-mediable
```

Register the package's service provider in `config/app.php`. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.

```
'providers' => [
    ...
    Plank\Mediable\MediableServiceProvider::class,
    ...
];
```

The package comes with a Facade for the image uploader, which you can optionally register as well. In Laravel versions 5.5 and beyond, this step can be skipped if package auto-discovery is enabled.

```
'aliases' => [
	...
    'MediaUploader' => Plank\Mediable\MediaUploaderFacade::class,
    ...
]
```

Publish the config file (`config/mediable.php`) of the package using artisan.

```
php artisan vendor:publish --provider="Plank\Mediable\MediableServiceProvider"
```

Run the migrations to add the required tables to your database.

```
php artisan migrate
```

Documentation
-------------

[](#documentation)

Read the documentation [here](http://laravel-mediable.readthedocs.io/en/latest/).

License
-------

[](#license)

This package is released under the MIT license (MIT).

About Plank
-----------

[](#about-plank)

[Plank](http://plankdesign.com) is a web development agency based in Montreal, Canada.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~29 days

Recently: every ~10 days

Total

13

Last Release

1447d ago

Major Versions

1.4.0 → 2.0.02022-04-15

PHP version history (2 changes)1.0PHP &gt;=7.3.0

1.1PHP &gt;=7.3.0|^8.0

### Community

Maintainers

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

---

Top Contributors

[![mywutao](https://avatars.githubusercontent.com/u/113573993?v=4)](https://github.com/mywutao "mywutao (8 commits)")

---

Tags

laravelimageeloquentmediauploader

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wutaophp-laravel-mediable/health.svg)

```
[![Health](https://phpackages.com/badges/wutaophp-laravel-mediable/health.svg)](https://phpackages.com/packages/wutaophp-laravel-mediable)
```

###  Alternatives

[plank/laravel-mediable

A package for easily uploading and attaching media files to models with Laravel

8271.5M11](/packages/plank-laravel-mediable)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)

PHPackages © 2026

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