mesilov/dadata-php-sdk-unofficial

A PHP library for the DaData.ru REST API.

dev-master 2014-06-22 09:05 UTC

This package is auto-updated.

Last update: 2024-12-20 10:11:47 UTC


README

A PHP library for the DaData.ru REST API

API documentation

Example

// init lib
require_once('../src/dadata.php');

$arDirtyNames = array(
	'Иванов Иван Иванонович',
	'иванов иван иванович',
	'ivanov ivan ivanovich',
	'иванов'
);

$arCleanData = array();
print('<pre>');
try
{
	// https://dadata.ru/api/clean/
	$obDaData = new DaData\DaData('YOUR API KEY');
	// normalize names with non - strict mode
	foreach($arDirtyNames as $dirtyData)
	{
		$arCleanData[] = $obDaData->normalizeFullName($dirtyData, false);
	}
	var_dump($arCleanData);

	// normalize name with strict mode
	$arCleanData[] = $obDaData->normalizeFullName($arDirtyNames[0], true);
}
catch (DaData\DaDataException $e)
{
	var_dump($e->getMessage());
	var_dump($e->getTraceAsString());
}
print('</pre>');

Installation

Update your composer.json file

    "require": {
        "mesilov/dadata-php-sdk-unofficial":"dev-master"
    }

Support

email: mesilov.maxim@gmail.com
vk: mesilov.maxim
twitter: @mesilov