isudakoff/yii2-dadata-suggestions

Yii2 DaData Suggestions

dev-master 2018-02-09 03:48 UTC

This package is auto-updated.

Last update: 2024-10-29 05:16:03 UTC


README

This extension allows you to easily get tips from service DaData.ru

Installation

The preferred way to install this extension is through composer.

Run

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

or add

"isudakoff/yii2-dadata-suggestions": "*"

to the require section of your composer.json.

Usage

Add to config:

'components' => [
    // ...
    'dadata' => [
        'class' => 'isudakoff\dadata\Suggest',
        'token' => 'your_token_here',
    ],
 ]

Get array of Address where needed

$addresses = Yii::$app->dadata->getAddresses('москва проспект мира 10', 10);

$street = $addresses[0]->street
$city = $addresses[0]->city
$country = $addresses[0]->country

TBD

  • Add more types of suggestion
  • Add docs