Download the PHP package yoelpc4/laravel-media without Composer

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

Packagist Downloads Build Code Coverage

Laravel Media manager.

Requirement

Install

Require this package with composer via command:

Package Publication

Publish package configuration via command:

Publish package migrations via command:

Publish package resources via command:

Configure

Image Optimizers

By default, all images added to the media will be optimized according to image_optimizers on the media config. For more information visit https://github.com/spatie/image-optimizer#optimization-tools.

Media Model

Customize media model by extending \Yoelpc4\LaravelMedia\Models\Media, then register your model on model option.

Media Observer

Customize media observer by extending \Yoelpc4\LaravelMedia\Observers\MediaObserver, then register your observer on observer option.

Versioned URL

Generate media URL with version on query params i.e: http://localhost/storage/1/image.jpg?v=1610970549 by setting versioned_url option to true.

Mediable Model

Mediable Contract and InteractsWithMedia Concern

The model that has media must implement \Yoelpc4\LaravelMedia\Contracts\Mediable interface and use \Yoelpc4\LaravelMedia\Concerns\InteractsWithMedia trait.

Example Mediable Contract and InteractsWithMedia Concern usage with profileImage relationship on User model

Media Group Registration

Example register the media group on your mediable model on Project model

Media Conversion Registration

Example register the media conversion on media group registration on User model

Media Group

The media group has name, mime types, max file size, max file limit & media conversions registration properties. It consists of one file or many files. The mime types, max file size, max file limit properties will be used on validation when adding file to the media. The default media group has empty array mime types, 2MB max file size, & null max file limit.

If media group has max file limit with integer data type (other than null), this package will keep last of max file limit file(s) on disk and remove the other file(s). For example User model has profile image media group with max file limit 1, and we have an user id 1 has a profile image as media id 1 on database. If we try to upload a profile image on user id 1, then media id 1 and old profile image will be deleted and user id 1 ends up with media id 2 and new profile image.

Media Conversion

The media conversion has name, manipulations, and should be performed on media group properties. It is intended to the media with file type image. You can call \Spatie\Image\Manipulations methods on media conversion registration because it has __call magic method, the proxied method call will be registered as it's manipulations.

Add Media File to Mediable

Add Media File from Path

Example add a media file from storage path to the first User model on database

Add Media File from Uploaded File

Example add a media file from \Illuminate\Http\UploadedFile to the unsaved Project model

Media URL Generation

Get Media URL

Example get media url on media

Get Media Conversion URL

Example get media conversion url on related media

If the media doesn't have the specified media conversion name it'll return null.

Difference From spatie/laravel-medialibrary

Media Group vs Media Collection

laravel-media use media group as the term of similar media type, while laravel-medialibrary use media collection as the term.

Mandatory Media Group

laravel-media require you to add file to the named media group on mediable model. While laravel-medialibrary offers flexibility to omit media group name and gives you "default" as media group name.

Validation Exception

laravel-media always perform validation based on registered media group's mime types and max file size, the \Illuminate\Validation\ValidationException will be thrown when validation is unmet. On the other hand laravel-medialibrary throws \Spatie\MediaLibrary\MediaCollections\Exceptions\FileUnacceptableForCollection instead of \Illuminate\Validation\ValidationException.

Add File to Unsaved Mediable Model

laravel-media allows you to add media file to the unsaved mediable model. While laravel-medialibrary expects every media must be attached to the saved mediable model.

For more information see issues here:

Also the pull request here:

File source

laravel-media only allows you to add file from disk path and uploaded file. While laravel-media allows you to add file from disk path, remote file, uploaded file, symfony file, temporary upload, url, & request.

Comprehensive vs Narrow Solution

laravel-media offers you narrow solution with limited features for specific requirements (validation exception, unsaved mediable model, & simple file source). While laravel-medialibrary offers you comprehensive solution with rich features and battle tested. So consider carefully prior to install this package.

License

The Laravel Media is open-sourced software licensed under the MIT license.


All versions of laravel-media with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
ext-fileinfo Version *
illuminate/contracts Version 8.*|7.*|6.*
illuminate/database Version 8.*|7.*|6.*
illuminate/http Version 8.*|7.*|6.*
illuminate/support Version 8.*|7.*|6.*
illuminate/validation Version 8.*|7.*|6.*
spatie/image Version ^1.10.1
spatie/temporary-directory Version ^1.3.0
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 yoelpc4/laravel-media contains the following files

Loading the files please wait ....