ronasit / laravel-media
A module for working with Media.
Requires
- php: ^8.3
- laravel/framework: ^11.21
- 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
This package is auto-updated.
Last update: 2024-11-17 12:35:40 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:
#routes/api.php <?php use Illuminate\Support\Facades\Route; Route::media([ 'create' => true, 'delete' => true, 'bulk_create' => false, 'search' => true, ]);
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.