The purpose of this fork is to make the spatie/laravel-medialibrary
package compatible with PHP 7.3.
The compatibility is ensured using 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"
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.
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, 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.
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
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. We publish all received postcards on our virtual postcard wall.
You'll find the documentation on https://docs.spatie.be/laravel-medialibrary/v8.
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, we'll try to address it as soon as possible.
If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.
You can run the tests with:
vendor/bin/phpunit
Please see UPGRADING for details.
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
A big thank you to Nicolas Beauvais for helping out with the issues on this repo.
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
Does your business depend on our contributions? Reach out and support us on Patreon. All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.
The MIT License (MIT). Please see License File for more information.