PHP code example of promopult / dadata-client

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

    

promopult / dadata-client example snippets


$client = new \Promopult\Dadata\Client(
    new \Promopult\Dadata\Credentials(getenv('__TOKEN__'), getenv('__SECRET__')),
    new \GuzzleHttp\Client()
);

$suggestions = $client->suggestions->partySuggest('сбербанк');

var_dump($suggestions); 

/*
{
  "suggestions": [
    {
      "value": "ПАО СБЕРБАНК",
      "unrestricted_value": "ПАО СБЕРБАНК",
      "data": {
        "kpp": "773601001",
        "capital": null,
        "management": {
          "name": "Греф Герман Оскарович",
          "post": "ПРЕЗИДЕНТ, ПРЕДСЕДАТЕЛЬ ПРАВЛЕНИЯ",
          "disqualified": null
        },
        "founders": null,
        "managers": null,
        "branch_type": "MAIN",
        "branch_count": 88,
        "source": null,
        "qc": null,
        "hid": "145a83ab38c9ad95889a7b894ce57a97cf6f6d5f42932a71331ff18606edecc6",
        "type": "LEGAL",
        "state": {
          "status": "ACTIVE",
          "actuality_date": 1564012800000,
          "registration_date": 677376000000,
          "liquidation_date": null
        },
        "opf": {
          "type": "2014",
          "code": "12247",
          "full": "Публичное акционерное общество",
          "short": "ПАО"
        },
        "name": {
          "full_with_opf": "ПУБЛИЧНОЕ АКЦИОНЕРНОЕ ОБЩЕСТВО \"СБЕРБАНК РОССИИ\"",
          "short_with_opf": "ПАО СБЕРБАНК",
          "latin": null,
          "full": "СБЕРБАНК РОССИИ",
          "short": "СБЕРБАНК"
        },
        "inn": "7707083893",
        "ogrn": "1027700132195",
        "okpo": null,
        "okved": "64.19",
        "okveds": null,
        "authorities": null,
        "documents": null,
        "licenses": null,
        "finance": null,
        "address": {
          "value": "г Москва, ул Вавилова, д 19",
          "unrestricted_value": "117312, г Москва, Академический р-н, ул Вавилова, д 19",
          "data": { ... }
        },
        "phones": null,
        "emails": null,
        "ogrn_date": 1029456000000,
        "okved_type": "2014",
        "employee_count": null
      }
    },
    ...
  ]
}
*/