Download the PHP package anisaronno/laravel-media-gallery without Composer

On this page you can find all versions of the php package anisaronno/laravel-media-gallery. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-media-gallery

Laravel Media Gallery

Table of Contents

Introduction

The Laravel Media Gallery simplifies media and media file management in your Laravel project. This README provides installation instructions, usage examples, and additional information.

Installation

To get started, install the package using Composer:

Publish Migration and Config

For media library features, follow these steps:

Publish Migration, Config

Publish the migration, factory and seeder file:

Publish the Config file:

Run Migration

Apply the migrations to set up the media storage table:

Uses

To use media storage in any model (e.g., User Blog, Product), add the HasMedia trait:

Eloquent Factories Relation Mapping

For setting up seed data with relation mapping (e.g., User has Blog, Blog uses HasMedia Trait), use the following code in a seeder:

Retrieve media by owner

To retrieve media by the user, use the HasMedia trait on the User/Team/Admin or any other model authorized to upload media:

Absolutely, here's the updated text with subheadings for each section:

Authentication and Configuration

Customizing Authentication Guard:

You can customize the authentication guard for the routes by publishing the config file and changing the 'guard' key to your desired authentication guard.

Alternatively, you can use the API middleware.

Restricting Media Viewing:

Set view_all_media_anyone to false to restrict media viewing to user-uploaded images only; default is true, allowing all media viewing.

Defining Gate for Managing Media:

Defines canManageMediaContent gate in AuthServiceProvider.php allowing designated users to manage media content.

Cache Expiry Time:

Set Cache Expiry time. Default value is 1440.

Use Media with Relational Model

For storing media for a relational model (e.g., Blog), use the following methods:

Working with Single or Featured Media

To work with a single or featured media, use the featuredMedia method and set isFeatured to true in the second parameter:

Note: Sync and detach are the same; use featuredMedia instead of featuredMedia.

Helper Methods

You can also use helper methods for media management:

API Route for Media/Media

To manage your media storage, you can use the following routes:

Fetch Media/Media from Relational Model

To retrieve media/media from a relational model:

You can access media properties like URL, title, mimes, size, and type:

Contribution Guide

Please follow our Contribution Guide if you'd like to contribute to this package.

License

This package is open-source software licensed under the MIT License.


All versions of laravel-media-gallery with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
laravel/framework Version ^8.0|^9.0|^10.0|^11.0
anisaronno/laravel-media-helper Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package anisaronno/laravel-media-gallery contains the following files

Loading the files please wait ....