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

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

bmarsaud/laravel-medialibrary
=============================

Associate files with Eloquent models for PHP 7.3

8.10.1(5y ago)125MITPHPPHP ^7.3

Since Apr 22Pushed 5y agoCompare

[ Source](https://github.com/bmarsaud/laravel-medialibrary)[ Packagist](https://packagist.org/packages/bmarsaud/laravel-medialibrary)[ Docs](https://github.com/bmarsaud/laravel-medialibrary)[ Fund](https://spatie.be/open-source/support-us)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/bmarsaud-laravel-medialibrary/feed)WikiDiscussions 8.10.1 Synced 3d ago

READMEChangelogDependencies (20)Versions (310)Used By (0)

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)

Why this fork ?
---------------

[](#why-this-fork-)

The purpose of this fork is to make the `spatie/laravel-medialibrary` package compatible with PHP 7.3.

The compatibility is ensured using [Rector](https://github.com/rectorphp/rector) plus some manual tweaks.

Note that the only version currently available is the `8.10.1`.

A more durable and reliable way would be to use a GitHub action applying Rector on each tag pushed on the original repository.

Install this package using the following command and follow the official documentation.

```
composer require "bmarsaud/laravel-medialibrary:^8.10.1"
```

Description
-----------

[](#description)

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://docs.spatie.be/laravel-medialibrary/v8).

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/5.6/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)

[![Image](https://camo.githubusercontent.com/5765574264aaab65056009f0228946efaf3975ad60e1a90dcac81dbd6a6af944/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d6d656469616c6962726172792e6a7067)](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.

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)

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

[](#support-us-1)

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

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/spatie). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 80.9% 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 ~6 days

Total

308

Last Release

2040d ago

Major Versions

6.9.2 → 7.5.22018-11-19

v3.x-dev → 7.19.02020-03-03

7.19.3 → 8.0.02020-03-09

7.19.4 → 8.8.02020-09-30

8.10.0 → v9.x-dev2020-10-09

PHP version history (8 changes)0.1.0PHP &gt;=5.4.0

2.0.0PHP &gt;=5.5.0

3.12.0PHP ^5.5|^7.0

4.0.0PHP ^7.0

7.0.0PHP ^7.1

7.6.0PHP ^7.2

8.0.0PHP ^7.4

8.10.1.x-devPHP ^7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/6af64f6dbe6fa99b725db78995e1b8baaae12f45583fe6d4f399c58fe50896b3?d=identicon)[bmarsaud](/maintainers/bmarsaud)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (1238 commits)")[![brendt](https://avatars.githubusercontent.com/u/6905297?v=4)](https://github.com/brendt "brendt (69 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (66 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (32 commits)")[![MatthiasDeWinter](https://avatars.githubusercontent.com/u/8791525?v=4)](https://github.com/MatthiasDeWinter "MatthiasDeWinter (25 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (12 commits)")[![ahmedofali](https://avatars.githubusercontent.com/u/22732463?v=4)](https://github.com/ahmedofali "ahmedofali (8 commits)")[![arubacao](https://avatars.githubusercontent.com/u/7462542?v=4)](https://github.com/arubacao "arubacao (7 commits)")[![bmarsaud](https://avatars.githubusercontent.com/u/2720587?v=4)](https://github.com/bmarsaud "bmarsaud (7 commits)")[![nicolasbeauvais](https://avatars.githubusercontent.com/u/2951704?v=4)](https://github.com/nicolasbeauvais "nicolasbeauvais (5 commits)")[![willemvb](https://avatars.githubusercontent.com/u/1336390?v=4)](https://github.com/willemvb "willemvb (4 commits)")[![antonkomarev](https://avatars.githubusercontent.com/u/1849174?v=4)](https://github.com/antonkomarev "antonkomarev (4 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (4 commits)")[![Firtzberg](https://avatars.githubusercontent.com/u/8490119?v=4)](https://github.com/Firtzberg "Firtzberg (4 commits)")[![gdebrauwer](https://avatars.githubusercontent.com/u/22586858?v=4)](https://github.com/gdebrauwer "gdebrauwer (4 commits)")[![TVke](https://avatars.githubusercontent.com/u/15680337?v=4)](https://github.com/TVke "TVke (3 commits)")[![Omranic](https://avatars.githubusercontent.com/u/406705?v=4)](https://github.com/Omranic "Omranic (3 commits)")[![Rhincodon](https://avatars.githubusercontent.com/u/6630959?v=4)](https://github.com/Rhincodon "Rhincodon (3 commits)")[![canvural](https://avatars.githubusercontent.com/u/1574232?v=4)](https://github.com/canvural "canvural (3 commits)")[![francoism90](https://avatars.githubusercontent.com/u/5028905?v=4)](https://github.com/francoism90 "francoism90 (3 commits)")

---

Tags

laravellaravel-medialibrarymedialibraryphp73spatielaravelconversionimagesmediacmsdownloadslaravel-medialibraryphp73

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-medialibrary

Associate files with Eloquent models

6.1k37.7M472](/packages/spatie-laravel-medialibrary)[okipa/laravel-medialibrary-ext

Extra features for spatie/laravel-medialibrary package.

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

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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