corpsepk/yii2-dadata-suggestions-widget DaData Suggestions jQuery widget wrapper

widgetdadatasuggestions

yii2-dadata-suggestions-widget

Latest Version Build Status Coverage Status Quality Score

Wrapper for DaData's jQuery plugin

Installation

1. Download

The preferred way to install this extension is through composer.

Run the following command:

$ composer require corpsepk/yii2-dadata-suggestions-widget:~0.4

2. Get api key

Register at DaData.ru, and get api key.

3. Configure (optional)

You can setup container definitions if you do not want to enter api key in every widget. Add following lines to your main configuration file:

'container' => [
    'definitions' => [
        'corpsepk\DaData\SuggestionsWidget' => [
            'token' => 'my-dadata-api-key',
        ],
    ],
],

Usage

use corpsepk\DaData\SuggestionsWidget;
<?= SuggestionsWidget::widget([
    'model' => $model,
    'attribute' => 'inn',
    'token' => 'your apiKey'
]) ?>

The following example will use the name property instead:

<?= SuggestionsWidget::widget([
    'name' => 'inn',
    'token' => 'your apiKey'
]) ?>

You can also use this widget in an yii\widgets\ActiveForm using the yii\widgets\ActiveField::widget() method, for example like this:

<?= $form->field($model, 'inn')->widget(SuggestionsWidget::class, [
    'token' => 'your apiKey'
]) ?>

Useful links

Testing

$ ./vendor/bin/phpunit

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

  • 0.425 September 2018
  • 0.313 March 2018
  • 0.203 March 2017
  • 0.102 March 2017

Comments



0.4 is the latest of 4 releases



MIT license
Stats
10 github stars & 3 github forks
21 downloads in the last day
387 downloads in the last 30 days
23872 total downloads