PHP code example of skeeks / yii2-dadata-client

1. Go to this page and download the library: Download skeeks/yii2-dadata-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

skeeks / yii2-dadata-client example snippets


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


$response = \Yii::$app->dadataClient->suggest->address("Москва");
print_r($response); //Array response data

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

$response = \Yii::$app->dadataClient->suggest->email("test@ya");
print_r($response); //Array response data

$response = \Yii::$app->dadataClient->suggest->fio("Семен");
print_r($response); //Array response data

php composer.phar