Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/mesilov/dadata-php-sdk-unofficial

A PHP library for the DaData.ru REST API
https://github.com/mesilov/dadata-php-sdk-unofficial

Last synced: 15 days ago
JSON representation

A PHP library for the DaData.ru REST API

Awesome Lists containing this project

README

        

dadata-php-sdk (unofficial)
=========================

A PHP library for the DaData.ru REST API

[API documentation](https://dadata.ru/api/clean/)
## Example ##
``` php
// init lib
require_once('../src/dadata.php');

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

$arCleanData = array();
print('

');

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('

');
```
## Installation ##
Update your composer.json file
``` json
"require": {
"mesilov/dadata-php-sdk-unofficial":"dev-master"
}
```
## Support ##
email:
vk: [mesilov.maxim](https://vk.com/mesilov.maxim)
twitter: [@mesilov](https://twitter.com/mesilov)