ronasit/laravel-media

A module for working with Media.

0.0.4-beta 2024-11-13 08:32 UTC

README

Coverage Status

Introduction

This plugin adds the ability for users to work with media files.

Installation

  1. Install the package using the following command:
composer require ronasit/laravel-media
  1. Publish the package configuration:
php artisan vendor:publish --provider=RonasIT\\Media\\MediaServiceProvider
  1. For Laravel <= 5.5 add RonasIT\Media\MediaServiceProvider::class to config app.providers list.
  2. 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.