Download the PHP package khaleghi/media without Composer

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

Media store

Build Status Issues Forks Stars Total Downloads

khaleghi/media-store is a Laravel package which created to provide an easy way to store any kind of files on server storage and save their attributes in the database. The other purpose of this package is to store images in a way that to be used in various responsive dimensions. This package is supported and tested in Laravel 5.4 and above.

Requirements

PHP >= 5.4

Installation

Run the following command:

Then run the following:

You have to make a link between public folder and storage by running this command:

Configuration

Set the property values in the config/media.php. These values will be used by media-store to make proper image sizes and customized upload folder.

Usage

Saving Images

Let's make a form in a html file:

Then make a route like this:

Now, All ever we have to do in our controller is:

We can display the image like this:

Responsive images

By default, The image we store in a way like above will be saved in 4 paths:

You can access url of each path by sending these parameters:

Fill free to change default image sizes at config\media.php

Note: khaleghi/media-store uses Intervension Image package to change dimension of images. It will be installed on your project as a dependency.

Saving other file types

You can store all other file types in a way that mentioned before. They will save in these paths related to their mime types:

Polymorphism

The Medium model is a polymorphic class. So you can make a relation between your other models to this model.

Now you can access to user's file:

And reverse access:

Note: Don't forget to use morphMany in medium's related model (here: App\User).

Determine before saving

You can make an instance of medium model and change it's attribute before save it:

Delete a medium

To delete a medium from Storage and Database you need to use remove method:

Database

These fields will be stored in database and you are able to access them through instance of Medium model:

Field Name Usage
stored_name The name that file will store in storage folder
file_name Original name of the file
caption
mime
size Size of the file in bytes
width Just for images
height Just for images
mediumable_type Name of model that this file is related to it
mediumable_id model primary key that this file is related to it
position Assigning a priority to each file with same manner of mediumable_type
manner What this file is good for. Example: avatar
comments_count
likes_count
description

License

Media-store is free software distributed under the terms of the MIT license.


All versions of media with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3
laravel/framework Version ~5.1
intervention/image Version ^2.4
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 khaleghi/media contains the following files

Loading the files please wait ....