Download the PHP package enigmatix/yii2-select without Composer

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

yii2-select2

Yii2 wrapper for the Select2 javascript widget.

This library makes the popular Select2 widget available for easy use in Yii2 projects within an ActiveForm. Please note that you cannot currently use this library to create a standalone Select2 widget without using an ActiveForm.

This widget is intentionally light on proprietary code, and instead favours existing Yii2 objects, classes and helpers where they are provided. It also provides a passthrough mechanism so you can use the full Select2 range of options without having to rely on support being manually added to this php widget.

REQUIREMENTS

The minimum requirement by this library is:

  1. your Web server supports PHP 5.4.0
  2. you have Yii2 installed
  3. You have correctly configured the composer fxp plugin as per the original Yii2 installation instructions

INSTALLATION

composer  require enigmatix/yii2-select "*"

GETTING STARTED

use enigmatix/yii2select/Select2;

$dropdownList = ['Yes' => 'Yes', 'No'];

<?= $form->field($model, 'your_field_name')->widget(Select2::className(), 
   ['list' => $dropdownList]) ?>

MULTIPLE SELECTION BOX

You can set additional attributes for the 'select' html element by passing values into the 'fieldOptions'

<?= $form->field($model, 'your_field_name')->widget(Select2::className(), 
   [
        'list' => $dropdownList,
        'fieldOptions' => [
            'multiple' => true
        ]
   ]) ?>

ADVANCED USAGE

If you need to pass javascript expressions (functions or anything more complex than a string you will need to use an instance of yii\web\JsExpression to ensure the resulting config is encoded correctly. See http://www.yiiframework.com/doc-2.0/yii-web-jsexpression.html for more details: eg

$ajaxDataFunction = new JsExpression("function (term, page) {return {q: term,};}")

<?= $form->field($model, 'your_field_name')->widget(Select2::className(), 
 [
    'list' => $dropdownList
    'pluginOptions => [
        'ajax' => [
            'data => $ajaxDataFunction,            
       ]
 ]) ?>

USING NATIVE SELECT2 FEATURES

As per the original Select2 docs found here: https://select2.github.io/ you can implement any of these features via the pluginOptions array. The array you build is passed through and JSON encoded as is, and will override any defaults within the widget itself.

CONTRIBUTIONS

If you would like to contribute to this codebase, please make a pull request or report an issue. The types of contributions that will be most useful are:

  1. adding php abstractions for new features
  2. refining the ajax support (not currently supported)
  3. coding practice feedback and better customisability and usability

But of course all feedback is welcome :).


All versions of yii2-select with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
npm-asset/select2 Version *
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 enigmatix/yii2-select contains the following files

Loading the files please wait ...