Download the PHP package mix8872/yii2-files without Composer

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

Yii2-files module

Module for attach any files to the your models.

This module is a new version of mix8872/files-attacher and not compatible with it!
You may use old mix8872/files-attacher or completely delete it and install this module.
The migration mechanism is not provided.

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json.

Then you must run migration by running command:

yii migrate --migrationPath=@vendor/mix8872/yii2-files/src/migrations

Configure

To configure module please add following to the modules section of common main config:

Common:

Frontend:

Important!!!

Don't forget deny access to module from frontend app!!!

Backend:

In config you may define access control to prevent access to the administrative part of the module.

Also you can define sizes to create additional sizes for uploaded images.

In resize definitions, also you can optional define model for which scaling will be applied. Support definition several models as array.

To use sizes names template you may define sizesNameTemplate option, where %k - key, %s - size. By default - %s;

If origResize option defined original image size will be changed. Also you can define models array;

Also you can change image driver to imagick.

By define filesNameBy option you may change files naming style from random string to translit file name, also you can define model attribute too.

For changing default save path you can define savePath option. The path will be considered from the web directory.

Usage

Using the module is available as a widget and behavior for the model.

First, you must configure the behavior of the required models in this way:

In tags attribute you may define tags for attach files, if you define same tags in delteOld attribute then files loaded with this tags will be rewritten by newly added files.

Also you can configure attachment parameters directly in behavior:

Any way you must declare fileAttachBehavior with this name files:

If you need do a batch update models with their files then you may define indexBy behavior property
and specify the name of the parent model property that will be used for indexing. By default is id.

Next you may add widget model and echo widget with its config:

!!! IMPORTANT !!!
You may define form with ['options' => ['enctype' => 'multipart/form-data']] if you use stay alone widget instead input widget!

If uses input widget - multipart/form-data automatically added to you form.

Also you can attach file to model by url as follows:

You can get the model files by calling the method:

or by accessing as property:

If uses getting files as property then you get array of files objects if property is multiple or single file object if not.

Events

On adding, updating and deletion files will generates next events:

For catching events you can declare this functions in you model:

triggered on adding a file

triggered on updating a file

triggered on file deletion

Console

Coming soon


All versions of yii2-files with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
ext-mbstring Version *
ext-intl Version *
npm-asset/bootstrap-fileinput Version ~5.1
intervention/image Version *
himiklab/yii2-sortable-grid-view-widget Version *
twbs/bootstrap-icons Version ^1.10
yiisoft/yii2-bootstrap5 Version 2.0.3
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 mix8872/yii2-files contains the following files

Loading the files please wait ....