2017 © Pedro PelΓ‘ez
 

yii2-extension yii2-dadata-suggest-api

Suggest yii2 api dadata.ru

image

skeeks/yii2-dadata-suggest-api

Suggest yii2 api dadata.ru

  • Thursday, November 10, 2016
  • by skeeks-semenov
  • Repository
  • 1 Watchers
  • 2 Stars
  • 443 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 5 % Grown

The README.md

API подсказок Dadata.ru

Info

  • https://dadata.ru/api/suggest/

Installation

The preferred way to install this extension is through composer., (*1)

add to composer.json, (*2)

"repositories": [
    {
        "type": "git",
        "url":  "https://github.com/skeeks-semenov/yii2-dadata-suggest-api.git"
    }
],

Either run, (*3)

php composer.phar require --prefer-dist skeeks/yii2-dadata-suggest-api "*"

or add, (*4)

"skeeks/yii2-dadata-suggest-api": "*"

How to use

//App config
[
    'components'    =>
    [
    //....
        'dadataSuggestApi' =>
        [
            'class'                 => 'skeeks\yii2\dadataSuggestApi\DadataSuggestApi',
            'authorization_token'   => 'token',
            'timeout'               => 12,
        ],
    //....
    ]
]

Examples

АдрСсныС подсказки

$response = \Yii::$app->dadataSuggestApi->send('/rs/suggest/address', [
    'query' => 'Π₯Π°Π±Π°Ρ€',
    'count' => 10
]);

print_r($response->httpClientRequest->url);     //Full api url
print_r($response->httpClientRequest->data);    //Request data
print_r($response->httpClientRequest->method);  //Request method
print_r($response->httpClientRequest->headers); //Request headers

print_r($response->httpClientResponse->statusCode); //Server response code
print_r($response->httpClientResponse->content);    //Original api response

if ($response->isError)
{
    print_r($response->errorMessage); //Π Π°ΡΡˆΠΈΡ„Ρ€ΠΎΠ²ΠΊΠ° ΠΊΠΎΠ΄Π°
    print_r($response->errorData);
    print_r($response->errorCode);
} else
{
    print_r($response->data); //Array response data
}

ΠžΠΏΡ€Π΅Π΄Π΅Π»Π΅Π½ΠΈΠ΅ полоТСния ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ ΠΏΠΎ ip

$response = \Yii::$app->dadataSuggestApi->detectAddressByIp(\Yii::$app->request->userIP);

Подсказки email

$response = \Yii::$app->dadataSuggestApi->getEmail([
    'query' => 'info@',
    'count' => 10
]);

Подсказки Ρ„ΠΈΠΎ

$response = \Yii::$app->dadataSuggestApi->getFio([
    'query' => 'Π‘Π΅ΠΌΠ΅Π½',
    'count' => 10
]);

skeeks!
SkeekS CMS (Yii2) β€” fast, simple, effective!
skeeks.com | cms.skeeks.com | marketplace.cms.skeeks.com, (*5)

The Versions

10/11 2016

dev-master

9999999-dev http://www.skeeks.com/

Suggest yii2 api dadata.ru

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

api framework app yii skeeks

10/11 2016

1.0.0-rc2

1.0.0.0-RC2 http://www.skeeks.com/

Suggest yii2 api dadata.ru

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

api framework app yii skeeks

10/11 2016

1.0.0

1.0.0.0 http://www.skeeks.com/

Suggest yii2 api dadata.ru

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

api framework app yii skeeks

10/11 2016

1.0.0-rc

1.0.0.0-RC http://www.skeeks.com/

Suggest yii2 api dadata.ru

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

api framework app yii skeeks

26/09 2016

1.0.0-beta

1.0.0.0-beta http://www.skeeks.com/

Suggest yii2 api dadata.ru

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

api framework app yii skeeks

22/09 2016

1.0.0-alpha2

1.0.0.0-alpha2 http://www.skeeks.com/

Suggest yii2 api dadata.ru

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

api framework app yii skeeks

22/09 2016

1.0.0-alpha

1.0.0.0-alpha http://www.skeeks.com/

Suggest yii2 api dadata.ru

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

api framework app yii skeeks