PHPackages                             spotted/laravel-medialibrary - 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. spotted/laravel-medialibrary

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

spotted/laravel-medialibrary
============================

Associate files with Eloquent models

9.9.0(1y ago)0331MITPHPPHP ^7.4|^8.0

Since Jan 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sadiqse024/spotted-medialibrary)[ Packagist](https://packagist.org/packages/spotted/laravel-medialibrary)[ Docs](https://github.com/spotted/laravel-medialibrary)[ RSS](/packages/spotted-laravel-medialibrary/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (22)Versions (2)Used By (1)

[![Social Card of Laravel Media Library](/art/socialcard.png)](/art/socialcard.png)

Associate files with Eloquent models
====================================

[](#associate-files-with-eloquent-models)

[![Latest Version](https://camo.githubusercontent.com/e4e512a2a6f24ff4330e48f9b15191ddbf68e232c6d178a5de1fd23ce41676a1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f7370617469652f6c61726176656c2d6d656469616c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://github.com/spatie/laravel-medialibrary/releases)[![GitHub Workflow Status](https://camo.githubusercontent.com/b07d40c194b7e428319e1a89fec5062ad4818a6d18f241082cf1640ed6f99a58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d6d656469616c6962726172792f72756e2d74657374733f6c6162656c3d7465737473)](https://camo.githubusercontent.com/b07d40c194b7e428319e1a89fec5062ad4818a6d18f241082cf1640ed6f99a58/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d6d656469616c6962726172792f72756e2d74657374733f6c6162656c3d7465737473)[![Total Downloads](https://camo.githubusercontent.com/03393070342eb3b7bf5a63fd48eefe709a09344144a82d73a0987889dcad75cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d6d656469616c6962726172792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-medialibrary)

This package can associate all sorts of files with Eloquent models. It provides a simple API to work with. To learn all about it, head over to [the extensive documentation](https://spatie.be/docs/laravel-medialibrary).

Here are a few short examples of what you can do:

```
$newsItem = News::find(1);
$newsItem->addMedia($pathToFile)->toMediaCollection('images');
```

It can handle your uploads directly:

```
$newsItem->addMedia($request->file('image'))->toMediaCollection('images');
```

Want to store some large files on another filesystem? No problem:

```
$newsItem->addMedia($smallFile)->toMediaCollection('downloads', 'local');
$newsItem->addMedia($bigFile)->toMediaCollection('downloads', 's3');
```

The storage of the files is handled by [Laravel's Filesystem](https://laravel.com/docs/filesystem), so you can use any filesystem you like. Additionally the package can create image manipulations on images and pdfs that have been added in the media library.

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/beb6722b22192d6acfdec6d589ed7f292cfffcd8279adf5048dfa859a3bbe21b/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d6d656469616c6962726172792e6a70673f743d32)](https://spatie.be/github-ad-click/laravel-medialibrary)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

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

[](#documentation)

You'll find the documentation on .

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the media library? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-medialibrary/issues), we'll try to address it as soon as possible.

If you've found a bug regarding security please mail  instead of using the issue tracker.

Testing
-------

[](#testing)

You can run the tests with:

```
vendor/bin/phpunit
```

Upgrading
---------

[](#upgrading)

Please see [UPGRADING](UPGRADING.md) for details.

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

A big thank you to [Nicolas Beauvais](https://github.com/nicolasbeauvais) for helping out with the issues on this repo.

And a special thanks to [Caneco](https://twitter.com/caneco) for the logo ✨

Alternatives
------------

[](#alternatives)

- [laravel-mediable](https://github.com/plank/laravel-mediable)
- [laravel-stapler](https://github.com/CodeSleeve/laravel-stapler)
- [media-manager](https://github.com/talvbansal/media-manager)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance42

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity43

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

473d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/37364c7d4390d8410fe2707f771d4f5158d0ea52c29c93b181537e049865ea8b?d=identicon)[sadiqse024](/maintainers/sadiqse024)

---

Top Contributors

[![sadiq810](https://avatars.githubusercontent.com/u/10768377?v=4)](https://github.com/sadiq810 "sadiq810 (2 commits)")

---

Tags

laravelconversionimagesmediacmsdownloadslaravel-medialibraryspotted

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spotted-laravel-medialibrary/health.svg)

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

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.1k37.7M472](/packages/spatie-laravel-medialibrary)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[okipa/laravel-medialibrary-ext

Extra features for spatie/laravel-medialibrary package.

1011.2k](/packages/okipa-laravel-medialibrary-ext)

PHPackages © 2026

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