PHP code example of dmapt / dadata-php-sdk

1. Go to this page and download the library: Download dmapt/dadata-php-sdk 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/ */

    

dmapt / dadata-php-sdk example snippets

 json
    "dmapt/dadata-php-sdk":"*"
    }
 php
$dirtyNames = [
    'иванов иван иванович',
    'ivanov ivan ivanovich',
    'иванов',
];

try {
	$dadataApi = new dmapt\DaData\Api('YOUR API TOKEN', 'YOUR API SECRET');

	$response = null;
	$cleanNames = $dadataApi->cleanName($dirtyNames, 'result', $response);
	var_dump($cleanNames);
	var_dump($response);
	
	var_dump($dadataApi->suggestParty('сбербанк'))
	
	var_dump($dadataApi->detectAddressByIp());
	
	
	
} catch (DaDataException $e) {
	var_dump($e->getMessage());
}