Download the PHP package ogrre/laravel-media without Composer

On this page you can find all versions of the php package ogrre/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 Version GitHub License Packagist Downloads

Introduction

This Laravel package allows you to associate media with models to be able to manage your files more easily.

This is my first package, do not hesitate to report problems, I may not have thought of everything

Documentation, Installation, and Usage Instructions

See the documentation for detailed installation and usage instructions.

Installation

This package publishes a config/media.php file. If you already have a file by that name, you must rename or remove it.

You can install the package via composer:

The service provider is automatically registered in app.php, but you can add the service provider manually in config/app.php

You need to start the migration for this to work well, so make sure you have media.php in the config folder as well as the create_media_tables.php file in the database/migrations folder of your application.

If this is not the case run the command

Configuration

By default, the Media class will take as an attribute mime_type and disk the values of the media configuration file. You can change there values in config/media.php.

Usages

This package works with two classes, the class Media and the class MediaFile, to manage the files it is necessary to associate a model, such as a user for example, with a media, such as avatar for example. It is therefore necessary to create the avatar media first.

Media

The Media class works as an eloquent model of Laravel create, update,... etc

You can create the media as follows

In this situation, the media will be created with the default attributes corresponding to the configuration file.

Otherwise, you can do it in the classic way

Once the Media are created, you can associate them with a model that has the trait hasMedia.

For exemple User model

To associate Media at User model

You can check if model has media

MediaFile

When a media is associated with a model, you can add a file that will be associated with the model as well as the media, it works like a classic crud.

getMediaFile function will return the MediaFile model with all the useful data about the file.

updateMediaFile function will delete the previously saved file and save a new one to the media disk.

deleteMediaFile will delete the Mediafile associated to Model as well as file.

Contributing

Contributions are welcome and will be fully credited. I accept contributions via Pull Requests on Github.

Support me

Buy Me A Coffee


All versions of laravel-media with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0|^8.1
illuminate/database Version ^7.0|^8.0|^9.0|^10.0
illuminate/support Version ^7.0|^8.0|^9.0|^10.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 ogrre/laravel-media contains the following files

Loading the files please wait ....