Download the PHP package runthis/laravel-media without Composer

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

A tiny laravel package to conveniently handle single file media uploads with little configuration.

Installation

composer require runthis/laravel-media

Usage

Add to the file you want to process uploads in, such as a controller.

use Runthis\Media\Facades\Media;
use Runthis\Media\Requests\MediaRequest;

Include the MediaRequest class in the function parameter and execute the create method on the Media facade.

Example:

public function upload(MediaRequest $request) {
    $test = Media::create($request);
    dd($test);
}

Inside the dd() you can see the complete object details and process these as you see fit (such as keeping track of these uploads in a database if you like).

Within the object results is a size key. You can simply echo this out to get the bytes, or you can add ->pretty() to get a prettier output. You can also pass a string parameter to the pretty() method.

Options:

l: lowercase suffix (12.45 mb instead of 12.45 MB)
s: spacing omitted (12.45MB instead of 12.45 MB)
b: Ending "B" removed (12.45 M instead of 12.45 MB)

Examples:

$test->size->pretty('sb'); // 12.45M
$test->size->pretty('ls'); // 12.45m
$test->size->pretty('l'); // 12.45 mb
$test->size->pretty('bl'); // 12.45 m

The Media::create method expects a file with the key named file.

Publish Config

If you want, run the below command to add a media.php file to your config folder.

php artisan vendor:publish --tag="media-config"

From the media config file you can change the storage disk name and the rules for the media (such as file types, size limit, etc).

Changelog

Please see CHANGELOG for more information on what has changed recently.


All versions of laravel-media with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
guzzlehttp/guzzle Version ^7.4
illuminate/contracts Version ^9.0
illuminate/http Version ^9.9
illuminate/support Version ^9.9
spatie/laravel-package-tools Version ^1.9.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 runthis/laravel-media contains the following files

Loading the files please wait ....