mrssoft/yii2-dadata

Components for working with Dadata

Installs: 39

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Type:yii2-extension

1.1.1 2024-05-02 03:57 UTC

This package is auto-updated.

Last update: 2024-11-02 05:14:44 UTC


README

Components for working with Dadata

Latest Stable Version PHP Github Total Downloads

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);