ronasit / laravel-media
A module for working with Media.
Requires
- php: ^8.3
- laravel/framework: ^11.30
- ronasit/laravel-helpers: ^3.0.0-beta
- spatie/laravel-medialibrary: ^11.8.3
Requires (Dev)
- orchestra/testbench: ^9.3
- php-coveralls/php-coveralls: ^2.7
- phpunit/phpunit: ^10.5.30
- dev-master
- 0.0.6-beta
- 0.0.5-beta
- 0.0.4-beta
- 0.0.3-beta
- 0.0.2-beta
- 0.0.1-beta
- dev-35-delete-preview-with-the-origin-media
- dev-39-move-max-upload-size-to-config
- dev-33_return-preview-key-in-response
- dev-rguskov/implement-media-factory
- dev-11-add-preview-generation-when-uploading-an-image
- dev-24-ability-to-register-package-routes-in-required-place-of-the-app
- dev-rguskov/test-fpv-branch
- dev-preview
- dev-rguskov/fix-installation
- dev-update-dependencies-laravel11
- dev-18-env-files-are-not-visible
- dev-9-file-deletion
- dev-14-automatic-running-tests-on-commit
This package is auto-updated.
Last update: 2024-12-26 14:15:27 UTC
README
Introduction
This plugin adds the ability for users to work with media files.
Installation
- Install the package using the following command:
composer require ronasit/laravel-media
- Publish the package configuration:
php artisan vendor:publish --provider=RonasIT\\Media\\MediaServiceProvider
- For Laravel <= 5.5 add
RonasIT\Media\MediaServiceProvider::class
to configapp.providers
list. - Set your project's User model to the
media.classes.user_model
config.
Usage
All media routes, will be automatically registered with the package installation.
You can manually register package routes in any place in your app routes using Route::media()
helper:
#routes/api.php <?php use Illuminate\Support\Facades\Route; Route::group(['middleware' => ['my_auth']], function () { Route::media(); });
In this case automatically registered package routes will fails with the 404
code error.
Customizing
You can register only necessary routes using MediaRouteActionEnum:
#routes/api.php <?php use Illuminate\Support\Facades\Route; use RonasIT\Media\Enums\MediaRouteActionEnum; Route::media(MediaRouteActionEnum::SingleUpload, MediaRouteActionEnum::Delete);
Integration with LaravelSwagger
This package includes OpenAPI documentation file. To include it to your project's documentation, you need to register it in the auto-doc.additional_paths
config:
vendor/ronasit/laravel-media/documentation.json
Contributing
Thank you for considering contributing to Laravel Media plugin! The contribution guide can be found in the Contributing guide.
License
Laravel Media plugin is open-sourced software licensed under the MIT license.