k90mirzaei/media

This is a media handler associate files with Eloquent models

v1.0.3 2022-01-12 10:37 UTC

This package is auto-updated.

Last update: 2024-10-26 10:09:56 UTC


README

Latest Version GitHub Workflow Status Total Downloads

This package can associate all sorts of files with Eloquent models. It provides a simple API to work with.

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, audios and videos.

Contributing

Please see CONTRIBUTING for details.

Testing

You can run the tests with:

vendor/bin/phpunit

License

The MIT License (MIT). Please see License File for more information.