The Laravel Media Helper simplifies the management of media and image files in your Laravel project. This README provides installation instructions, usage examples, and additional information.
To get started, install the package using Composer:
composer require anisaronno/laravel-media-helper
Upload an image or file:
use AnisAronno\MediaHelper\Facades\Media;
Media::upload($request, $fieldName, string $upload_dir)
Upload an image or file with a specific storage disk:
use AnisAronno\MediaHelper\Facades\Media;
Media::setStorageDisk('public')->upload($request, $fieldName, string $upload_dir)
Retrieve an image or file by its path:
use AnisAronno\MediaHelper\Facades\Media;
Media::getURL($path)
Retrieve an image or file with a specific storage disk:
use AnisAronno\MediaHelper\Facades\Media;
Media::setStorageDisk('public')->getURL($path)
Delete an image or file by its path:
use AnisAronno\MediaHelper\Facades\Media;
Media::delete($path)
Delete an image or file with a specific storage disk:
use AnisAronno\MediaHelper\Facades\Media;
Media::setStorageDisk('public')->delete($path)
Retrieve the default image or file:
use AnisAronno\MediaHelper\Facades\Media;
Media::getDefaultFilesURL();
Retrieve default files as an associative array:
Media::getDefaultFilesURL(true);
Retrieve default files by specific value or method:
Media::getDefaultFilesURL(true, 'placeholder');
Media::getDefaultLogo();
Media::getDefaultFavIcon();
Media::getDefaultBanner();
Media::getDefaultAvatar();
Media::getDefaultPlaceholder();
Please follow our Contribution Guide if you'd like to contribute to this package.
This package is open-source software licensed under the MIT License.