Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/skeeks-semenov/yii2-dadata-client

https://dadata.ru/api/#address
https://github.com/skeeks-semenov/yii2-dadata-client

Last synced: about 13 hours ago
JSON representation

https://dadata.ru/api/#address

Awesome Lists containing this project

README

        

API Dadata.ru
===================================

Info
------------
* https://dadata.ru/api/

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist skeeks/yii2-dadata-client "*"
```

or add

```
"skeeks/yii2-dadata-client": "*"
```

How to use
----------

```php
//App config
[
'components' =>
[
//....
'dadataClient' =>
[
'class' => 'skeeks\yii2\dadataClient\dadataClient',
'token' => 'token',
'secret' => 'secret',
'timeout' => 12,
],
//....
]
]

```

Examples
----------

### Адресные подсказки
```php
$response = \Yii::$app->dadataClient->suggest->address("Москва");
print_r($response); //Array response data
```

### Определение положения пользователя по ip
```php
$response = \Yii::$app->dadataSuggestApi->detectAddressByIp(\Yii::$app->request->userIP);
```

### Подсказки email
```php
$response = \Yii::$app->dadataClient->suggest->email("test@ya");
print_r($response); //Array response data
```

### Подсказки фио
```php
$response = \Yii::$app->dadataClient->suggest->fio("Семен");
print_r($response); //Array response data
```

___

> [![skeeks!](https://skeeks.com/img/logo/logo-no-title-80px.png)](https://skeeks.com)
SkeekS CMS (Yii2) — quickly, easily and effectively!
[skeeks.com](https://skeeks.com) | [cms.skeeks.com](https://cms.skeeks.com)