mrssoft/yii2-dadata

Components for working with Dadata

Installs: 30

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

1.1.0 2019-04-02 02:00 UTC

This package is auto-updated.

Last update: 2024-03-29 03:03:57 UTC


README

Components for working with Dadata

DaData API

Installation

The preferred way to install this extension is through composer. Either run

php composer.phar require --prefer-dist mrssoft/yii2-dadata "*"

or add

"mrssoft/yii2-dadata": "*"

to the require section of your composer.json file.

Usage

echo DaDataInputWidget::widget([
    'name' => 'name',
    'options' => [
        'class' => 'form-control'
        'placeholder' => 'you placeholder'
    ],
    'clientOptions' => [
        'token' => 'you token',
        'count' => 5,
        'type' => DaDataInputWidget::TYPE_PARTY,
    ],
    'clientEvents' => [
        'onSelect' => new \yii\web\JsExpression('function (suggestion) {
            console.log(suggestion);
        }')            
    ]
]);
$ipLocate = new DaDataIpLocate(['token' => '...']);

$response = $ipLocate->address();
//or
$response = $ipLocate->address($ip);