Download the PHP package elegantly/laravel-media without Composer

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

Flexible Media Library for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package offers an extremely flexible media library, enabling you to store any type of file along with their conversions (nested conversions are supported). It is designed to work seamlessly with any filesystem solutions (local or cloud) such as Bunny.net, AWS S3/MediaConvert, Transloadit, among others.

The inspiration for this package is derived from the exceptional spatie/laravel-media-library package (be sure to check out Spatie's packages, they are top-notch). However, it is not a fork, as the internal architecture is different, providing you with more capabilities. Migration from spatie/laravel-media-library is feasible but may be challenging if you wish to retain your conversion files.

Motivation

The Spatie team has developed a remarkable package, spatie/laravel-media-library, which is well-suited for most common scenarios. However, I found myself constrained by their architecture for my own project. To address this, I required the following features:

Consequently, I developed this package with the highest degree of flexibility possible. I have been utilizing it in production for nearly a year, handling terabytes of files monthly.

Full Example

The following example will provide you with a better understanding of the package's capabilities.

We will create a YouTube-like service, with a model named Channel. This Channel will have two types of media: avatar and videos. We will define these media types in the registerMediaCollections method.

We want to store the avatars in a square format, with dimensions not exceeding 500px, and in the WebP format. We will accomplish this in the registerMediaTransformations method.

For each media type, we will need a set of conversions, as illustrated in the following tree:

We will define these conversions in the registerMediaConversions method.

Here is how our Channel class will be defined:

From now, we will be able to store files in the easiest way possible:

Storing a file from a Controller

Storing a file from a Livewire component

Installation

You can install the package via composer:

You have to publish and run the migrations with:

You can publish the config file with:

This is the contents of the published config file:

Optionally, you can publish the views using

Introduction to the Concepts

There are two essential concepts to understand, both of which are associated with the Model and its media:

Usage

Preparing Your Models

This package is designed to associate media with a model, but it can also be used without any model association.

Registering Media Collections

First, you need to add the HasMedia trait and the InteractWithMedia interface to your Model:

You can then define your media collections in the registerMediaCollections method:

Registering Media Conversions

This package provides common jobs for your conversions to simplify your work:

Using Your Own Media Model

You can define your own Media model to use with the library.

First, create your own model class:

Then, update the config file:

The library is typed with generics, so you can use your own Media model seamlessly:

Testing

Changelog

Please see the CHANGELOG for more information on recent changes.

Contributing

Feel free to open an issue or a discussion.

Security Vulnerabilities

Please contact me to report security vulnerabilities.

Credits

License

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


All versions of laravel-media with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^11.0
maennchen/zipstream-php Version ^3.1
pbmedia/laravel-ffmpeg Version ^8.3
spatie/image Version ^3.0.0
spatie/laravel-package-tools Version ^1.14.0
spatie/temporary-directory Version ^2.2
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 elegantly/laravel-media contains the following files

Loading the files please wait ....