Download the PHP package sergmoro1/yii2-uploader without Composer

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

Yii2 module for image|file upload

Multiple uploading, sorting file collection by mouse, adding description for the file, cropping. Resize images using the queue component.

Demo

Photos by categories, photo gallery BEFORE | AFTER.

Advantages

A common approach for working with uploading images or files in an application.

If the model needs images or files, it is enough:

For example common\models\User.php

Directories

Information about all uploaded files are stored in one table onefile. There is no need to define a field of type file in the model, which need files.

The files are uploaded and stored in the directory defined as a concatenation of paths of three aliases @absolute, @host and @uploader. All aleases should be defined in appropriate config file. For example in common/config/main-local.php if storage folder are the same for backend and fronend.

But there may be different configurations.

If both the backend and frontend are on the same host, the @host alias can be leaved empty. The same case for basic Yii template.

In the folder the files are arranged by users and sizes.

Where 2 is the user ID or subdir. subdir can be blank, then all files will be saved in one folder. subdir can be defined when widget placed in a view.

Sizes in an example are thumb, main, original. More sizes can be defined but those are must have.

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist sergmoro1/yii2-uploader

or add

"sergmoro1/yii2-uploader": "^2.0.0"

to the require section of your composer.json.

Run migration.

php yii migrate --migrationPath=@vendor/sergmoro1/yii2-uploader/src/migrations

If you used a previous version sergmoro1\yii2-byone-uploader then run only the next migration.

php yii migrate --migrationPath=@vendor/sergmoro1/yii2-uploader/src/migrations/v1

Configuration

To register the module in an app common/config/main.php (advanced) or in appropriate config file.

For file storage configuration in common/config/main-local.php or any other config file add lines appropriate for your app.

If queue should be using for image resizing, then queue component must be defined. The name of the queue component must be exactly queue.

Usage

To do uploading place the widget in a _form.php or any other view.

If image should be cropped, subdirectories original, main, thumb must to be defined.

May be uploaded any amount of files for one model but files amount can be limited by limit parameter of the widget.

If subdir will be defined as an empty string then all files will be uploaded in the same folder but with subfolders that was defined in sizes.

Description of uploaded files

You can leave descriptions to the files. To do this in the _form.php, in the already mentioned widget, you need to add the parameter appendeixView.

And add to the view/views/user/appendix.php the following content:

Field description defined by default, but fields not limited.

Widget options

cropAllowed (false)

If image should be cropped, original, main, thumb sizes must be defined.

The cropping sizes are specified by the main directory where catalor parameter should be equal ''.

If this directory is set to square, then the remaining sizes will be square after cropping.

draggable (false)

Make true if uploaded files should be swapped.

allowedTypes ( [] )

To control files types on a client side, ['image/pjpeg', 'image/jpeg', 'image/png', 'image/x-png', 'image/gif', 'image/x-gif']. Any if empty.

allowedTypesReg ( '/image\\/[jpeg|jpg|png|gif]/i' )

Server side control. Any if empty. Preferable way to check allowed types to upload.

appendixView ( '' )

View file name of additional fields for uploaded files. See views/user/appendix.php.

minFileSize ( 0 )

Minimum file size in bytes. 0 for any.

maxFileSize ( 0 )

Maximum file size in bytes. 0 for any.

limit ( 0 )

Maximum amount of files to upload for one model. 0 for any.

secure ( true )

Ordinary user authorization required, but verification may be switched off.

subdir ( null )

If null (by defauld) $model->id will be used.


All versions of yii2-uploader with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
yiisoft/yii2 Version ^2.0.0
yiisoft/yii2-jui Version ~2.0.0
yiisoft/yii2-imagine Version ^2.2
yiisoft/yii2-queue Version ^2.3
npm-asset/jquery-simple-upload Version ^1.1
bower-asset/jcrop Version ^2.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 sergmoro1/yii2-uploader contains the following files

Loading the files please wait ....