Download the PHP package r94ever/laravel-media without Composer

On this page you can find all versions of the php package r94ever/laravel-media. 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

Laravel Media

An easy solution to attach files to your eloquent models, with image manipulation built in!

Packagist Version Build Status License

Installation

You can install the package via composer:

Once installed, you should publish the provided assets to create the necessary migration and config files.

Key concepts

There are a few key concepts that should be understood before continuing:

Usage

Upload media

You should use the Optix\Media\MediaUploader class to handle file uploads.

By default, this class will update files to the disk specified in the media config. It saves them as a sanitised version of their original file name, and creates a media record in the database with the file's details.

You can also customise certain properties of the file before it's uploaded.

Associate media with a model

In order to associate a media item with a model, you must first include the Optix\Media\HasMedia trait.

This trait will setup the relationship between your model and the media model. It's primary purpose is to provide a fluent api for attaching and retrieving media.

Once included, you can attach media to the model as demonstrated below. The first parameter of the attach media method can either be a media model instance, an id, or an iterable list of models / ids.

Disassociate media from a model

To disassociate media from a model, you should call the provided detachMedia method.

If you want to delete a media item, you should do it the same way you would for any other model in your application.

Doing so will delete the file from your filesystem, and also remove any association between the media item and your application's models.

Retrieve media

Another feature of the HasMedia trait is the ability to retrieve media.

As well as retrieve media items, you can also retrieve attributes of the media model directly from your model.

Manipulate Images

This package provides a fluent api to manipulate images. You can specify a model to perform "conversions" when media is attached to a group. It uses the familiar intervention/image library under the hood, so images can be manipulated using all of the library's provided options.

To get started, you should first register a conversion in one of your application's service providers:

Once you've registered a conversion, you should configure a media group to perform the conversion when media is attached to your model.

Now when a media item is attached to the "gallery" group, a converted image will be generated. You can get the url of the converted image as demonstrated below:

Why use this package?

There are already packages that exist to solve a similar problem to the one that this package was built to achieve.

The most popular of which are:

There are a few key differences between this package and the ones listed above. Our package was built to power media managers, and make it easy to perform image manipulations. This is better represented by the comparison table below:

Comparison Spatie Plank Optix
Relationship type One to many Many to many Many to many
Provides image manipulation Yes No Yes
Definition of manipulations Specific to a model - Global registry

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-media with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.1
laravel/framework Version ~5.8.0|^6.0|^7.0|^8.0|^9.0
intervention/image Version ^2.5
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 r94ever/laravel-media contains the following files

Loading the files please wait ....