├── .gitignore ├── src ├── Enums │ ├── BankStatus.php │ ├── Language.php │ ├── CompanyType.php │ ├── BranchType.php │ ├── Gender.php │ ├── CompanyScope.php │ ├── Parts.php │ ├── CompanyStatus.php │ └── BankType.php ├── Exceptions │ └── Handler.php ├── Facades │ ├── DaDataPhone.php │ ├── DaDataEmail.php │ ├── DaDataPassport.php │ ├── DaDataName.php │ ├── DaDataBank.php │ ├── DaDataCompany.php │ └── DaDataAddress.php ├── DaDataPhone.php ├── DaDataPassport.php ├── DaDataEmail.php ├── DaDataName.php ├── Providers │ ├── Client.php │ ├── CleanerDaDataProvider.php │ └── SuggestDaDataProvider.php ├── DaDataServiceProvider.php ├── DaDataService.php ├── DaDataBank.php ├── DaDataCompany.php └── DaDataAddress.php ├── .travis.yml ├── phpunit.xml.dist ├── tests ├── TestCase.php ├── DaDataPhoneTest.php ├── DaDataEmailTest.php ├── DaDataPassportTest.php ├── DaDataNameTest.php ├── DaDataBankTest.php ├── DaDataCompanyTest.php └── DaDataAddressTest.php ├── LICENSE ├── config └── dadata.php └── composer.json /.gitignore: -------------------------------------------------------------------------------- 1 | composer.lock 2 | *.cache 3 | vendor 4 | .idea 5 | -------------------------------------------------------------------------------- /src/Enums/BankStatus.php: -------------------------------------------------------------------------------- 1 | 'ru', 17 | self::EN => 'en', 18 | ]; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/Enums/CompanyType.php: -------------------------------------------------------------------------------- 1 | 'LEGAL', 19 | self::INDIVIDUAL => 'INDIVIDUAL', 20 | ]; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/Enums/BranchType.php: -------------------------------------------------------------------------------- 1 | 'MAIN', 20 | self::BRANCH => 'BRANCH', 21 | ]; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/Enums/Gender.php: -------------------------------------------------------------------------------- 1 | 'UNKNOWN', 17 | self::MALE => 'MALE', 18 | self::FEMALE => 'FEMALE', 19 | ]; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/Enums/CompanyScope.php: -------------------------------------------------------------------------------- 1 | 'FOUNDERS', 20 | self::MANAGERS => 'MANAGERS', 21 | ]; 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/Enums/Parts.php: -------------------------------------------------------------------------------- 1 | 'NAME', 17 | self::SURNAME => 'SURNAME', 18 | self::PATRONYMIC => 'PATRONYMIC', 19 | ]; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/Enums/CompanyStatus.php: -------------------------------------------------------------------------------- 1 | 'ACTIVE', 20 | self::LIQUIDATING => 'LIQUIDATING', 21 | self::LIQUIDATED => 'LIQUIDATED', 22 | ]; 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/Facades/DaDataPhone.php: -------------------------------------------------------------------------------- 1 | cleanerApi()->post('clean/phone', [$phone]); 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/Enums/BankType.php: -------------------------------------------------------------------------------- 1 | 'BANK', 24 | self::NKO => 'NKO', 25 | self::BANK_BRANCH => 'BANK_BRANCH', 26 | self::NKO_BRANCH => 'NKO_BRANCH', 27 | self::RKC => 'RKC', 28 | self::OTHER => 'OTHER', 29 | ]; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/Facades/DaDataCompany.php: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | tests 15 | 16 | 17 | 18 | 19 | src/ 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | 'MoveMoveIo\DaData\Facades\DaDataAddress', 19 | 'DaDataName' => 'MoveMoveIo\DaData\Facades\DaDataName', 20 | 'DaDataEmail' => 'MoveMoveIo\DaData\Facades\DaDataEmail', 21 | 'DaDataPhone' => 'MoveMoveIo\DaData\Facades\DaDataPhone', 22 | 'DaDataCompany' => 'MoveMoveIo\DaData\Facades\DaDataCompany', 23 | 'DaDataBank' => 'MoveMoveIo\DaData\Facades\DaDataBank', 24 | 'DaDataPassport' => 'MoveMoveIo\DaData\Facades\DaDataPassport', 25 | ]; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/DaDataPassport.php: -------------------------------------------------------------------------------- 1 | cleanerApi()->post('clean/passport', [$id]); 22 | } 23 | 24 | /** 25 | * Defin FMS unit by passport code or name 26 | * 27 | * @param string $passport 28 | * @param int $count 29 | * @return array 30 | * @throws \Exception 31 | */ 32 | public function fms(string $passport, int $count = 10) : array 33 | { 34 | return $this->suggestApi()->post('rs/suggest/fms_unit', [ 35 | 'query' => $passport, 36 | 'count' => $count, 37 | ]); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/DaDataEmail.php: -------------------------------------------------------------------------------- 1 | cleanerApi()->post('clean/email', [$email]); 25 | } 26 | 27 | /** 28 | * Auto detection by part of email 29 | * 30 | * @param string $email 31 | * @param int $count 32 | * @return array 33 | * @throws \Exception 34 | */ 35 | public function prompt(string $email, int $count = 10) : array 36 | { 37 | return $this->suggestApi()->post('rs/suggest/email', [ 38 | 'query' => $email, 39 | 'count' => $count, 40 | ]); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Dmitry Kovalev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config/dadata.php: -------------------------------------------------------------------------------- 1 | env('DADATA_TOKEN', null), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Secret key for standardization 27 | |-------------------------------------------------------------------------- 28 | */ 29 | 'secret' => env('DADATA_SECRET', null), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | DaData timeout 34 | |-------------------------------------------------------------------------- 35 | | The maximum number of seconds to wait for a response 36 | */ 37 | 'timeout' => env('DADATA_TIMEOUT', 10), 38 | 39 | ]; 40 | -------------------------------------------------------------------------------- /src/Facades/DaDataAddress.php: -------------------------------------------------------------------------------- 1 | cleanerApi()->post('clean/name', [$name]); 28 | } 29 | 30 | /** 31 | * Auto detection by part of name 32 | * 33 | * 34 | * 35 | * @param string $name 36 | * @param int $count 37 | * @param int $gender 38 | * @param array $parts 39 | * @return array 40 | * @throws \Exception 41 | */ 42 | public function prompt(string $name, int $count = 10, int $gender = Gender::UNKNOWN, array $parts = []) : array 43 | { 44 | for ($i = 0; $i < count($parts); $i++) { 45 | if (Parts::$map[$parts[$i]]) { 46 | $parts[$i] = Parts::$map[$parts[$i]]; 47 | } else { 48 | unset($parts[$i]); 49 | } 50 | } 51 | 52 | return $this->suggestApi()->post('rs/suggest/fio', [ 53 | 'query' => $name, 54 | 'count' => $count, 55 | 'gender' => Gender::$map[$gender] ?? Gender::$map[Gender::UNKNOWN], 56 | 'parts' => array_values($parts), 57 | ]); 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/Providers/Client.php: -------------------------------------------------------------------------------- 1 | timeout($timeout)->post($url, $data); 27 | 28 | return $this->data($response); 29 | } 30 | 31 | /** 32 | * @param array $headers 33 | * @param string $url 34 | * @param array $data 35 | * @param int $timeout 36 | * @return array 37 | * @throws \Exception 38 | */ 39 | public function getData(array $headers, string $url, array $data, int $timeout) : array 40 | { 41 | $response = Http::withHeaders($headers)->timeout($timeout)->get($url, $data); 42 | 43 | return $this->data($response); 44 | } 45 | 46 | /** 47 | * @param Response $response 48 | * @return array 49 | * @throws \Exception 50 | */ 51 | protected function data(Response $response) : array 52 | { 53 | $data = json_decode($response->body(), true); 54 | 55 | if ($response->status() != ResponseCode::HTTP_OK) { 56 | throw new \Exception($data['message'] ?? ResponseCode::$statusTexts[$response->status()], $response->status()); 57 | } 58 | 59 | return $data; 60 | } 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/Providers/CleanerDaDataProvider.php: -------------------------------------------------------------------------------- 1 | token = $token; 55 | $this->secret = $secret; 56 | $this->timeout = $timeout; 57 | $this->v = $v; 58 | 59 | } 60 | 61 | /** 62 | * @param string $method 63 | * @param array $data 64 | * @return array 65 | * @throws \Exception 66 | */ 67 | public function post(string $method, array $data = []) : array 68 | { 69 | $headers = [ 70 | 'Content-Type' => $this->content_type, 71 | 'Authorization' => sprintf('Token %s', $this->token), 72 | 'X-Secret' => $this->secret, 73 | ]; 74 | $url = sprintf('%s/%s/%s', $this->api, $this->v, $method); 75 | 76 | return $this->postData($headers, $url, $data, $this->timeout); 77 | } 78 | 79 | } 80 | -------------------------------------------------------------------------------- /tests/DaDataPhoneTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 16 | DaDataEmail::standardization('serega@yandex/ru'), 17 | $this->EmailProvider() 18 | ); 19 | } 20 | 21 | /** 22 | * @return array|array[] 23 | */ 24 | public function EmailProvider() : array 25 | { 26 | return [ 27 | [ 28 | "source" => "serega@yandex/ru", 29 | "email" => "serega@yandex.ru", 30 | "local" => "serega", 31 | "domain" => "yandex.ru", 32 | "type" => "PERSONAL", 33 | "qc" => 4, 34 | ] 35 | ]; 36 | } 37 | 38 | /** 39 | * @return array|array[] 40 | */ 41 | public function PromptProvider() : array 42 | { 43 | return [ 44 | "suggestions" => [ 45 | [ 46 | "value" => "anton@mail.ru", 47 | "unrestricted_value" => "anton@mail.ru", 48 | "data" => [ 49 | "local" => "anton", 50 | "domain" => "mail.ru", 51 | "type" => null, 52 | "source" => null, 53 | "qc" => null, 54 | ] 55 | ], [ 56 | "value" => "anton@gmail.com", 57 | "unrestricted_value" => "anton@gmail.com", 58 | "data" => [ 59 | "local" => "anton", 60 | "domain" => "gmail.com", 61 | "type" => null, 62 | "source" => null, 63 | "qc" => null, 64 | ] 65 | ] 66 | ] 67 | ]; 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /src/DaDataServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->singleton('da_data_address', function () { 22 | return new DaDataAddress(); 23 | }); 24 | $this->app->singleton('da_data_name', function () { 25 | return new DaDataName(); 26 | }); 27 | $this->app->singleton('da_data_email', function () { 28 | return new DaDataEmail(); 29 | }); 30 | $this->app->singleton('da_data_phone', function () { 31 | return new DaDataPhone(); 32 | }); 33 | $this->app->singleton('da_data_company', function () { 34 | return new DaDataCompany(); 35 | }); 36 | $this->app->singleton('da_data_bank', function () { 37 | return new DaDataBank(); 38 | }); 39 | $this->app->singleton('da_data_passport', function () { 40 | return new DaDataPassport(); 41 | }); 42 | 43 | $this->app->alias('da_data_address', DaDataAddress::class); 44 | $this->app->alias('da_data_name', DaDataName::class); 45 | $this->app->alias('da_data_email', DaDataEmail::class); 46 | $this->app->alias('da_data_phone', DaDataPhone::class); 47 | $this->app->alias('da_data_company', DaDataCompany::class); 48 | $this->app->alias('da_data_bank', DaDataCompany::class); 49 | $this->app->alias('da_data_passport', DaDataPassport::class); 50 | } 51 | 52 | /** 53 | * Bootstrap services. 54 | * 55 | * @return void 56 | */ 57 | public function boot() 58 | { 59 | $this->publishes([ 60 | __DIR__ . '/../config/dadata.php' => config_path('dadata.php'), 61 | ]); 62 | } 63 | 64 | 65 | } 66 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "movemoveapp/laravel-dadata", 3 | "description": "Laravel SDK for working with the DaData.RU service API", 4 | "keywords": [ 5 | "movemoveapp", 6 | "dadata", 7 | "laravel", 8 | "sdk", 9 | "address", 10 | "email", 11 | "passport", 12 | "bank", 13 | "name", 14 | "patronymic", 15 | "surname", 16 | "pipisco" 17 | ], 18 | "type": "laravel-package", 19 | "license": "MIT", 20 | "version": "1.0.10", 21 | "authors": [ 22 | { 23 | "name": "Dmitry Kovalev aka Pipisco", 24 | "email": "d.kovalev@movemove.io", 25 | "homepage": "https://movemove.io", 26 | "role": "Developer" 27 | } 28 | ], 29 | "minimum-stability": "dev", 30 | "autoload": { 31 | "psr-4": { 32 | "MoveMoveIo\\DaData\\": "src/" 33 | } 34 | }, 35 | "autoload-dev": { 36 | "psr-4": { 37 | "MoveMoveIo\\DaData\\Tests\\": "tests/" 38 | } 39 | }, 40 | "require": { 41 | "php" : "^7.3|^8.0|^8.1", 42 | "guzzlehttp/guzzle": "^7.0|^7.2" 43 | }, 44 | "require-dev": { 45 | "phpunit/phpunit": "^9.4.0", 46 | "orchestra/testbench": "^6.2.0" 47 | }, 48 | "scripts": { 49 | "test": "phpunit" 50 | }, 51 | "prefer-stable": true, 52 | "extra": { 53 | "laravel":{ 54 | "providers": [ 55 | "MoveMoveIo\\DaData\\DaDataServiceProvider" 56 | ], 57 | "aliases": { 58 | "DaDataAddress": "MoveMoveIo\\DaData\\Facades\\DaDataAddress", 59 | "DaDataName": "MoveMoveIo\\DaData\\Facades\\DaDataName", 60 | "DaDataEmail": "MoveMoveIo\\DaData\\Facades\\DaDataEmail", 61 | "DaDataPhone": "MoveMoveIo\\DaData\\Facades\\DaDataPhone", 62 | "DaDataCompany": "MoveMoveIo\\DaData\\Facades\\DaDataCompany", 63 | "DaDataBank": "MoveMoveIo\\DaData\\Facades\\DaDataBank", 64 | "DaDataPassport": "MoveMoveIo\\DaData\\Facades\\DaDataPassport" 65 | } 66 | } 67 | } 68 | } 69 | 70 | -------------------------------------------------------------------------------- /tests/DaDataEmailTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 20 | DaDataEmail::standardization('serega@yandex/ru'), 21 | $this->EmailProvider() 22 | ); 23 | } 24 | 25 | /** 26 | * @test 27 | */ 28 | public function testPromptFromString() 29 | { 30 | $this->assertSame( 31 | DaDataEmail::prompt('anton@', 2), 32 | $this->PromptProvider() 33 | ); 34 | } 35 | 36 | /** 37 | * @return array|array[] 38 | */ 39 | public function EmailProvider() : array 40 | { 41 | return [ 42 | [ 43 | "source" => "serega@yandex/ru", 44 | "email" => "serega@yandex.ru", 45 | "local" => "serega", 46 | "domain" => "yandex.ru", 47 | "type" => "PERSONAL", 48 | "qc" => 4, 49 | ] 50 | ]; 51 | } 52 | 53 | /** 54 | * @return array|array[] 55 | */ 56 | public function PromptProvider() : array 57 | { 58 | return [ 59 | "suggestions" => [ 60 | [ 61 | "value" => "anton@gmail.com", 62 | "unrestricted_value" => "anton@gmail.com", 63 | "data" => [ 64 | "local" => "anton", 65 | "domain" => "gmail.com", 66 | "type" => null, 67 | "source" => null, 68 | "qc" => null, 69 | ] 70 | ], [ 71 | "value" => "anton@mail.ru", 72 | "unrestricted_value" => "anton@mail.ru", 73 | "data" => [ 74 | "local" => "anton", 75 | "domain" => "mail.ru", 76 | "type" => null, 77 | "source" => null, 78 | "qc" => null, 79 | ] 80 | ] 81 | ] 82 | ]; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /tests/DaDataPassportTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 23 | DaDataPassport::standardization('4509 235857'), 24 | $this->PassportProvider() 25 | ); 26 | } 27 | 28 | /** 29 | * @test 30 | */ 31 | public function testDefineFmsUnitByPassportCode() 32 | { 33 | $this->assertSame( 34 | DaDataPassport::fms('772 053', 2), 35 | $this->FmsProvider() 36 | ); 37 | } 38 | 39 | /** 40 | * @return array|array[] 41 | */ 42 | public function PassportProvider() : array 43 | { 44 | return [ 45 | [ 46 | "source" => "4509 235857", 47 | "series" => "45 09", 48 | "number" => "235857", 49 | "qc" => 0 50 | ] 51 | ]; 52 | } 53 | 54 | /** 55 | * @return array|\array[][] 56 | */ 57 | public function FmsProvider() : array 58 | { 59 | return [ 60 | "suggestions" => [ 61 | [ 62 | "value" => "ОВД ЗЮЗИНО Г. МОСКВЫ", 63 | "unrestricted_value" => "ОВД ЗЮЗИНО Г. МОСКВЫ", 64 | "data" => [ 65 | "code" => "772-053", 66 | "name" => "ОВД ЗЮЗИНО Г. МОСКВЫ", 67 | "region_code" => "77", 68 | "type" => "2", 69 | ], 70 | ], [ 71 | "value" => "ОВД ЗЮЗИНО Г. МОСКВЫ ПАСПОРТНЫЙ СТОЛ 1", 72 | "unrestricted_value" => "ОВД ЗЮЗИНО Г. МОСКВЫ ПАСПОРТНЫЙ СТОЛ 1", 73 | "data" => [ 74 | "code" => "772-053", 75 | "name" => "ОВД ЗЮЗИНО Г. МОСКВЫ ПАСПОРТНЫЙ СТОЛ 1", 76 | "region_code" => "77", 77 | "type" => "2", 78 | ], 79 | ], 80 | ] 81 | ]; 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /src/Providers/SuggestDaDataProvider.php: -------------------------------------------------------------------------------- 1 | token = $token; 60 | $this->secret = $secret; 61 | $this->timeout = $timeout; 62 | $this->v = $v; 63 | 64 | } 65 | 66 | /** 67 | * @param string $method 68 | * @param array $data 69 | * @return array 70 | * @throws \Exception 71 | */ 72 | public function post(string $method, array $data = []) : array 73 | { 74 | $headers = [ 75 | 'Content-Type' => $this->content_type, 76 | 'Accept' => $this->accept, 77 | 'Authorization' => sprintf('Token %s', $this->token), 78 | 'X-Secret' => $this->secret, 79 | ]; 80 | $url = sprintf('%s/%s/%s', $this->api, $this->v, $method); 81 | 82 | return $this->postData($headers, $url, $data, $this->timeout); 83 | } 84 | 85 | /** 86 | * @param string $method 87 | * @param array $data 88 | * @return array 89 | * @throws \Exception 90 | */ 91 | public function get(string $method, array $data = []) : array 92 | { 93 | $headers = [ 94 | 'Accept' => $this->accept, 95 | 'Authorization' => sprintf('Token %s', $this->token), 96 | ]; 97 | $url = sprintf('%s/%s/%s', $this->api, $this->v, $method); 98 | 99 | return $this->getData($headers, $url, $data, $this->timeout); 100 | } 101 | 102 | 103 | 104 | } 105 | -------------------------------------------------------------------------------- /src/DaDataService.php: -------------------------------------------------------------------------------- 1 | token = config('dadata.token'); 47 | $this->secret = config('dadata.secret'); 48 | $this->timeout = config('dadata.timeout'); 49 | } else { 50 | $this->token = env('DADATA_TOKEN', null); 51 | $this->secret = env('DADATA_SECRET', null); 52 | $this->timeout = env('DADATA_TIMEOUT', 10); 53 | } 54 | } 55 | 56 | /** 57 | * @return string|null 58 | */ 59 | public function getToken() : ?string 60 | { 61 | return $this->token; 62 | } 63 | 64 | /** 65 | * @return string|null 66 | */ 67 | public function getSecret() : ?string 68 | { 69 | return $this->secret; 70 | } 71 | 72 | /** 73 | * @return int|null 74 | */ 75 | public function getTimeout() : ?int 76 | { 77 | return $this->timeout; 78 | } 79 | 80 | /** 81 | * @param string $v 82 | * @return CleanerDaDataProvider 83 | */ 84 | public function cleanerApi(string $v = 'v1') : CleanerDaDataProvider 85 | { 86 | if (! $this->cleanerApi instanceof CleanerDaDataProvider) 87 | { 88 | $this->cleanerApi = new CleanerDaDataProvider($this->token, $this->secret, $this->timeout, $v); 89 | } 90 | 91 | return $this->cleanerApi; 92 | } 93 | 94 | /** 95 | * @param string $v 96 | * @return SuggestDaDataProvider 97 | */ 98 | public function suggestApi(string $v = '4_1') : SuggestDaDataProvider 99 | { 100 | if (! $this->suggestApi instanceof SuggestDaDataProvider) { 101 | $this->suggestApi = new SuggestDaDataProvider($this->token, $this->secret, $this->timeout, $v); 102 | } 103 | 104 | return $this->suggestApi; 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /tests/DaDataNameTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 22 | DaDataName::standardization('Срегей владимерович иванов'), 23 | $this->NameProvider() 24 | ); 25 | } 26 | 27 | /** 28 | * @test 29 | */ 30 | public function testPromptFromString() 31 | { 32 | $this->assertSame( 33 | DaDataName::prompt('Викто', 2, Gender::UNKNOWN, [Parts::NAME]), 34 | $this->PromptProvider() 35 | ); 36 | } 37 | 38 | /** 39 | * @return array|array[] 40 | */ 41 | public function PromptProvider() : array 42 | { 43 | return [ 44 | "suggestions" => [ 45 | [ 46 | "value" => "Виктор", 47 | "unrestricted_value" => "Виктор", 48 | "data" => [ 49 | "surname" => null, 50 | "name" => "Виктор", 51 | "patronymic" => null, 52 | "gender" => "MALE", 53 | "source" => null, 54 | "qc" => "0", 55 | ] 56 | ], [ 57 | "value" => "Виктория", 58 | "unrestricted_value" => "Виктория", 59 | "data" => [ 60 | "surname" => null, 61 | "name" => "Виктория", 62 | "patronymic" => null, 63 | "gender" => "FEMALE", 64 | "source" => null, 65 | "qc" => "0", 66 | ] 67 | ] 68 | ] 69 | ]; 70 | } 71 | 72 | /** 73 | * @return array|array[] 74 | */ 75 | public function NameProvider() : array 76 | { 77 | return [ 78 | [ 79 | "source" => "Срегей владимерович иванов", 80 | "result" => "Иванов Сергей Владимирович", 81 | "result_genitive" => "Иванова Сергея Владимировича", 82 | "result_dative" => "Иванову Сергею Владимировичу", 83 | "result_ablative" => "Ивановым Сергеем Владимировичем", 84 | "surname" => "Иванов", 85 | "name" => "Сергей", 86 | "patronymic" => "Владимирович", 87 | "gender" => "М", 88 | "qc" => 1, 89 | ] 90 | ]; 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/DaDataBank.php: -------------------------------------------------------------------------------- 1 | suggestApi()->post('rs/findById/bank', ['query' => $bank]); 26 | } 27 | 28 | /** 29 | * Prompt bank by part of the ID 30 | * 31 | * @param string $company 32 | * @param int $count 33 | * @param array $status 34 | * @param array $type 35 | * @param string|null $locations 36 | * @param string|null $locations_boost 37 | * @return array 38 | * @throws \Exception 39 | */ 40 | public function prompt(string $company, 41 | int $count = 10, 42 | array $status = [BankStatus::ACTIVE], 43 | array $type = [BankType::BANK, BankType::BANK_BRANCH], 44 | string $locations = null, 45 | string $locations_boost = null 46 | 47 | ) : array 48 | { 49 | for ($i = 0; $i < count($status); $i++) { 50 | if (BankStatus::$map[$status[$i]]) { 51 | $status[$i] = BankStatus::$map[$status[$i]]; 52 | } else { 53 | unset($status[$i]); 54 | } 55 | } 56 | 57 | for ($i = 0; $i < count($type); $i++) { 58 | if (BankType::$map[$type[$i]]) { 59 | $type[$i] = BankType::$map[$type[$i]]; 60 | } else { 61 | unset($type[$i]); 62 | } 63 | } 64 | 65 | $locations_array = []; 66 | if (! is_null($locations)) { 67 | for ($i = 0; $i < count(explode(',', $locations)); $i++) { 68 | array_push($locations_array, ['kladr_id' => trim($locations[$i])]); 69 | } 70 | } 71 | 72 | $locations_boost_array = []; 73 | if (! is_null($locations_boost)) { 74 | for ($i = 0; $i < count(explode(',', $locations_boost)); $i++) { 75 | array_push($locations_boost_array, ['kladr_id' => trim($locations_boost[$i])]); 76 | } 77 | } 78 | 79 | return $this->suggestApi()->post('rs/suggest/bank', [ 80 | 'query' => $company, 81 | 'count' => $count, 82 | 'status' => array_values($status), 83 | 'type' => array_values($type), 84 | 'locations' => $locations_array, 85 | 'locations_boost' => $locations_boost_array, 86 | ]); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /src/DaDataCompany.php: -------------------------------------------------------------------------------- 1 | suggestApi()->post('rs/findById/party', [ 36 | 'query' => $id, 37 | 'count' => $count, 38 | 'kpp' => $kpp, 39 | 'branch_type' => BranchType::$map[$branch_type] ?? BranchType::$map[BranchType::MAIN], 40 | 'type' => CompanyStatus::$map[$type] ?? null, 41 | ]); 42 | } 43 | 44 | /** 45 | * Prompt company by part of company name 46 | * 47 | * Helps a person quickly enter company details on a web form or app. 48 | * 49 | * @param string $company 50 | * @param int $count 51 | * @param array $status 52 | * @param int $type 53 | * @param string|null $locations 54 | * @param string|null $locations_boost 55 | * @return array 56 | * @throws \Exception 57 | */ 58 | public function prompt(string $company, 59 | int $count = 10, 60 | array $status = [CompanyStatus::ACTIVE], 61 | int $type = CompanyType::INDIVIDUAL, 62 | string $locations = null, 63 | string $locations_boost = null 64 | 65 | ) : array 66 | { 67 | for ($i = 0; $i < count($status); $i++) { 68 | if (CompanyStatus::$map[$status[$i]]) { 69 | $status[$i] = CompanyStatus::$map[$status[$i]]; 70 | } else { 71 | unset($status[$i]); 72 | } 73 | } 74 | 75 | $locations_array = []; 76 | if (! is_null($locations)) { 77 | for ($i = 0; $i < count(explode(',', $locations)); $i++) { 78 | array_push($locations_array, ['kladr_id' => trim($locations[$i])]); 79 | } 80 | } 81 | 82 | $locations_boost_array = []; 83 | if (! is_null($locations_boost)) { 84 | for ($i = 0; $i < count(explode(',', $locations_boost)); $i++) { 85 | array_push($locations_boost_array, ['kladr_id' => trim($locations_boost[$i])]); 86 | } 87 | } 88 | 89 | return $this->suggestApi()->post('rs/suggest/party', [ 90 | 'query' => $company, 91 | 'count' => $count, 92 | 'status' => array_values($status), 93 | 'type' => CompanyType::$map[$type] ?? null, 94 | 'locations' => $locations_array, 95 | 'locations_boost' => $locations_boost_array, 96 | ]); 97 | } 98 | 99 | /** 100 | * Find affiliated companies 101 | * 102 | * @param string $id 103 | * @param int $count 104 | * @param array $scope 105 | * @return array 106 | * @throws \Exception 107 | */ 108 | public function affiliated(string $id, int $count = 10, array $scope = [CompanyScope::FOUNDERS]) : array 109 | { 110 | for ($i = 0; $i < count($scope); $i++) { 111 | if (CompanyScope::$map[$scope[$i]]) { 112 | $scope[$i] = CompanyScope::$map[$scope[$i]]; 113 | } else { 114 | unset($scope[$i]); 115 | } 116 | } 117 | 118 | return $this->suggestApi()->post('rs/findAffiliated/party', [ 119 | 'query' => $id, 120 | 'count' => $count, 121 | 'scope' => array_values($scope), 122 | ]); 123 | 124 | } 125 | 126 | } 127 | -------------------------------------------------------------------------------- /src/DaDataAddress.php: -------------------------------------------------------------------------------- 1 | cleanerApi()->post('clean/address', [$address]); 28 | } 29 | 30 | /** 31 | * Auto detection by part of address 32 | * 33 | * Helps the person quickly enter the correct address on a web form or app. 34 | * For Russian Federation and the whole world. 35 | * 36 | * @param string $query 37 | * @param int $count 38 | * @param int $language 39 | * @param array $locations 40 | * @param array $locations_geo 41 | * @param array $locations_boost 42 | * @param array $from_bound 43 | * @param array $to_bound 44 | * @return array 45 | * @throws \Exception 46 | */ 47 | public function prompt( 48 | string $query, 49 | int $count = 10, 50 | int $language = Language::RU, 51 | array $locations = [], 52 | array $locations_geo = [], 53 | array $locations_boost = [], 54 | array $from_bound = [], 55 | array $to_bound = [] 56 | ) : array 57 | { 58 | 59 | return $this->suggestApi()->post('rs/suggest/address', [ 60 | 'query' => $query, 61 | 'count' => $count, 62 | 'language' => Language::$map[$language] ?? Language::$map[Language::RU], 63 | 'locations' => $locations, 64 | 'locations_geo' => $locations_geo, 65 | 'locations_boost' => $locations_boost, 66 | 'from_bound' => $from_bound, 67 | 'to_bound' => $to_bound, 68 | ]); 69 | } 70 | 71 | /** 72 | * Geolocation 73 | * 74 | * Returns all information about the address by coordinates. 75 | * Works for homes, streets and cities. 76 | * @param float $lat 77 | * @param float $lon 78 | * @param int $count 79 | * @param int $radius_meters 80 | * @param int $language 81 | * @return array 82 | * @throws \Exception 83 | */ 84 | public function geolocate( 85 | float $lat, 86 | float $lon, 87 | int $count = 10, 88 | int $radius_meters = 100, 89 | int $language = Language::RU 90 | ) : array 91 | { 92 | return $this->suggestApi()->get('rs/geolocate/address', [ 93 | 'lat' => $lat, 94 | 'lon' => $lon, 95 | 'count' => $count, 96 | 'radius_meters' => $radius_meters, 97 | 'language' => Language::$map[$language] ?? Language::$map[Language::RU], 98 | ]); 99 | } 100 | 101 | /** 102 | * Define city by IPv4 103 | * 104 | * @param string $ip 105 | * @param int $count 106 | * @param int $language 107 | * @return array 108 | * @throws \Exception 109 | */ 110 | public function iplocate(string $ip, int $count = 10, int $language = Language::RU) : array 111 | { 112 | return $this->suggestApi()->get('rs/iplocate/address', [ 113 | 'ip' => $ip, 114 | 'count' => $count, 115 | 'language' => Language::$map[$language] ?? Language::$map[Language::RU], 116 | ]); 117 | } 118 | 119 | /** 120 | * Define address by KLADR or FIAS id 121 | * 122 | * @param string $id 123 | * @param int $count 124 | * @param int $language 125 | * @return array 126 | * @throws \Exception 127 | */ 128 | public function id(string $id, int $count = 10, int $language = Language::RU) : array 129 | { 130 | return $this->suggestApi()->post('rs/findById/address', [ 131 | 'query' => $id, 132 | 'count' => $count, 133 | 'language' => Language::$map[$language] ?? Language::$map[Language::RU], 134 | ]); 135 | } 136 | 137 | /** 138 | * Find postal unit by address 139 | * 140 | * @param string $address 141 | * @param int $count 142 | * @param int $language 143 | * @return array 144 | * @throws \Exception 145 | */ 146 | public function postalUnitByAddress(string $address, int $count = 10, int $language = Language::RU) : array 147 | { 148 | return $this->suggestApi()->post('rs/suggest/postal_unit', [ 149 | 'query' => $address, 150 | 'count' => $count, 151 | 'language' => Language::$map[$language] ?? Language::$map[Language::RU], 152 | ]); 153 | } 154 | 155 | /** 156 | * Find postal unit by postal code 157 | * 158 | * @param string $code 159 | * @param int $count 160 | * @param int $language 161 | * @return array 162 | * @throws \Exception 163 | */ 164 | public function postalUnitById(int $code, int $count = 10, int $language = Language::RU) : array 165 | { 166 | return $this->suggestApi()->post('rs/findById/postal_unit', [ 167 | 'query' => $code, 168 | 'count' => $count, 169 | 'language' => Language::$map[$language] ?? Language::$map[Language::RU], 170 | ]); 171 | } 172 | 173 | /** 174 | * Find by postal unit by GEO location 175 | * 176 | * @param float $lat 177 | * @param float $lon 178 | * @param int $radius_meters 179 | * @param int $count 180 | * @param int $language 181 | * @return array 182 | * @throws \Exception 183 | */ 184 | public function postalUnitByGeoLocate(float $lat, float $lon, int $radius_meters = 1000, int $count = 10, int $language = Language::RU) : array 185 | { 186 | return $this->suggestApi()->post('rs/geolocate/postal_unit', [ 187 | 'lat' => $lat, 188 | 'lon' => $lon, 189 | 'radius_meters' => $radius_meters, 190 | 'count' => $count, 191 | 'language' => Language::$map[$language] ?? Language::$map[Language::RU], 192 | ]); 193 | } 194 | 195 | 196 | /** 197 | * City ID in the delivery companies 198 | * 199 | * @param string $code 200 | * @return array 201 | * @throws \Exception 202 | */ 203 | public function delivery(string $code) : array 204 | { 205 | return $this->suggestApi()->post('rs/findById/delivery', ['query' => $code]); 206 | } 207 | 208 | /** 209 | * Get address by FIAS code 210 | * 211 | * @param string $code 212 | * @return array 213 | * @throws \Exception 214 | */ 215 | public function fias(string $code) : array 216 | { 217 | return $this->suggestApi()->post('rs/findById/fias', ['query' => $code]); 218 | } 219 | 220 | } 221 | -------------------------------------------------------------------------------- /tests/DaDataBankTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 22 | DaDataBank::id('044525225'), 23 | $this->findBankByIDProvider() 24 | ); 25 | } 26 | 27 | /** 28 | * @test 29 | */ 30 | public function testPromptFromString() 31 | { 32 | $this->assertSame( 33 | DaDataBank::prompt('сбербанк', 1, [BankStatus::ACTIVE], [BankType::BANK]), 34 | $this->promptFromStringProvider() 35 | ); 36 | } 37 | 38 | /** 39 | * @return array|array[], 40 | */ 41 | public function findBankByIDProvider(): array 42 | { 43 | return json_decode('{"suggestions":[{"value":"\u041f\u0410\u041e \u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a","unrestricted_value":"\u041f\u0410\u041e \u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a","data":{"opf":{"type":"BANK","full":null,"short":null},"name":{"payment":"\u041f\u0410\u041e \u0421\u0411\u0415\u0420\u0411\u0410\u041d\u041a","full":null,"short":"\u041f\u0410\u041e \u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a"},"bic":"044525225","swift":"SABRRUMM012","inn":"7707083893","kpp":"773601001","okpo":null,"correspondent_account":"30101810400000000225","treasury_accounts":null,"registration_number":"1481","payment_city":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","state":{"status":"ACTIVE","code":null,"actuality_date":1650758400000,"registration_date":677376000000,"liquidation_date":null},"rkc":null,"cbr":{"opf":{"type":"CBR","full":null,"short":null},"name":{"payment":"\u0413\u0423 \u0411\u0410\u041d\u041a\u0410 \u0420\u041e\u0421\u0421\u0418\u0418 \u041f\u041e \u0426\u0424\u041e","full":null,"short":null},"bic":"044525000","swift":null,"inn":null,"kpp":null,"okpo":null,"correspondent_account":null,"treasury_accounts":null,"registration_number":null,"payment_city":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430 35","state":{"status":"ACTIVE","code":null,"actuality_date":1650758400000,"registration_date":null,"liquidation_date":null},"rkc":null,"cbr":null,"address":{"value":"115035, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430 35, \u0443\u043b \u0411\u0430\u043b\u0447\u0443\u0433, 2","unrestricted_value":"115035, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430 35, \u0443\u043b \u0411\u0430\u043b\u0447\u0443\u0433, 2","data":null},"phones":null},"address":{"value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430, \u0434 19","unrestricted_value":"117312, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430, \u0434 19","data":{"postal_code":"117312","country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":"\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439","region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_iso_code":"RU-MOW","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","city_kladr_id":"7700000000000","city_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","city_type":"\u0433","city_type_full":"\u0433\u043e\u0440\u043e\u0434","city":"\u041c\u043e\u0441\u043a\u0432\u0430","city_area":"\u042e\u0433\u043e-\u0437\u0430\u043f\u0430\u0434\u043d\u044b\u0439","city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440-\u043d","city_district_type":"\u0440-\u043d","city_district_type_full":"\u0440\u0430\u0439\u043e\u043d","city_district":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439","settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":"25f8f29b-b110-40ab-a48e-9c72f5fb4331","street_kladr_id":"77000000000092400","street_with_type":"\u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430","stead_fias_id":null,"stead_cadnum":null,"stead_type":null,"stead_type_full":null,"stead":null,"house_fias_id":"93409d8c-d8d4-4491-838f-f9aa1678b5e6","house_kladr_id":"7700000000009240170","house_cadnum":"77:06:0002008:1036","house_type":"\u0434","house_type_full":"\u0434\u043e\u043c","house":"19","block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":null,"flat_cadnum":null,"flat_type":null,"flat_type_full":null,"flat":null,"flat_area":null,"square_meter_price":null,"flat_price":null,"postal_box":null,"fias_id":"93409d8c-d8d4-4491-838f-f9aa1678b5e6","fias_code":"77000000000000009240170","fias_level":"8","fias_actuality_state":"0","kladr_id":"7700000000009240170","geoname_id":"524901","capital_marker":"0","okato":"45293554000","oktmo":"45397000","tax_office":"7736","tax_office_legal":"7736","timezone":"UTC+3","geo_lat":"55.7001865","geo_lon":"37.5802234","beltway_hit":"IN_MKAD","beltway_distance":null,"metro":[{"name":"\u041b\u0435\u043d\u0438\u043d\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442","line":"\u041a\u0430\u043b\u0443\u0436\u0441\u043a\u043e-\u0420\u0438\u0436\u0441\u043a\u0430\u044f","distance":0.8},{"name":"\u041f\u043b\u043e\u0449\u0430\u0434\u044c \u0413\u0430\u0433\u0430\u0440\u0438\u043d\u0430","line":"\u041c\u0426\u041a","distance":0.8},{"name":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f","line":"\u041a\u0430\u043b\u0443\u0436\u0441\u043a\u043e-\u0420\u0438\u0436\u0441\u043a\u0430\u044f","distance":1.5}],"divisions":{"administrative":{"area":null,"city":{"fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","kladr_id":"7700000000000","type":"\u0433","type_full":"\u0433\u043e\u0440\u043e\u0434","name":"\u041c\u043e\u0441\u043a\u0432\u0430","name_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430"},"settlement":null,"city_district":{"fias_id":null,"kladr_id":null,"type":"\u0440-\u043d","type_full":"\u0440\u0430\u0439\u043e\u043d","name":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439","name_with_type":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440-\u043d"}},"municipal":null},"qc_geo":"0","qc_complete":"5","qc_house":"2","history_values":null,"unparsed_parts":null,"source":"117997, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430, 19","qc":"0"}},"phones":null}}]}', true); 44 | } 45 | 46 | public function promptFromStringProvider(): array 47 | { 48 | return json_decode('{"suggestions":[{"value":"\u041f\u0410\u041e \u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a","unrestricted_value":"\u041f\u0410\u041e \u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a","data":{"opf":{"type":"BANK","full":null,"short":null},"name":{"payment":"\u041f\u0410\u041e \u0421\u0411\u0415\u0420\u0411\u0410\u041d\u041a","full":null,"short":"\u041f\u0410\u041e \u0421\u0431\u0435\u0440\u0431\u0430\u043d\u043a"},"bic":"044525225","swift":"SABRRUMM012","inn":"7707083893","kpp":"773601001","okpo":null,"correspondent_account":"30101810400000000225","treasury_accounts":null,"registration_number":"1481","payment_city":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","state":{"status":"ACTIVE","code":null,"actuality_date":1650758400000,"registration_date":677376000000,"liquidation_date":null},"rkc":null,"cbr":null,"address":{"value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430, \u0434 19","unrestricted_value":"117312, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440-\u043d, \u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430, \u0434 19","data":{"postal_code":"117312","country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":"\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439","region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_iso_code":"RU-MOW","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","city_kladr_id":"7700000000000","city_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","city_type":"\u0433","city_type_full":"\u0433\u043e\u0440\u043e\u0434","city":"\u041c\u043e\u0441\u043a\u0432\u0430","city_area":"\u042e\u0433\u043e-\u0437\u0430\u043f\u0430\u0434\u043d\u044b\u0439","city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440-\u043d","city_district_type":"\u0440-\u043d","city_district_type_full":"\u0440\u0430\u0439\u043e\u043d","city_district":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439","settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":"25f8f29b-b110-40ab-a48e-9c72f5fb4331","street_kladr_id":"77000000000092400","street_with_type":"\u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430","stead_fias_id":null,"stead_cadnum":null,"stead_type":null,"stead_type_full":null,"stead":null,"house_fias_id":"93409d8c-d8d4-4491-838f-f9aa1678b5e6","house_kladr_id":"7700000000009240170","house_cadnum":"77:06:0002008:1036","house_type":"\u0434","house_type_full":"\u0434\u043e\u043c","house":"19","block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":null,"flat_cadnum":null,"flat_type":null,"flat_type_full":null,"flat":null,"flat_area":null,"square_meter_price":null,"flat_price":null,"postal_box":null,"fias_id":"93409d8c-d8d4-4491-838f-f9aa1678b5e6","fias_code":"77000000000000009240170","fias_level":"8","fias_actuality_state":"0","kladr_id":"7700000000009240170","geoname_id":"524901","capital_marker":"0","okato":"45293554000","oktmo":"45397000","tax_office":"7736","tax_office_legal":"7736","timezone":"UTC+3","geo_lat":"55.7001865","geo_lon":"37.5802234","beltway_hit":"IN_MKAD","beltway_distance":null,"metro":[{"name":"\u041b\u0435\u043d\u0438\u043d\u0441\u043a\u0438\u0439 \u043f\u0440\u043e\u0441\u043f\u0435\u043a\u0442","line":"\u041a\u0430\u043b\u0443\u0436\u0441\u043a\u043e-\u0420\u0438\u0436\u0441\u043a\u0430\u044f","distance":0.8},{"name":"\u041f\u043b\u043e\u0449\u0430\u0434\u044c \u0413\u0430\u0433\u0430\u0440\u0438\u043d\u0430","line":"\u041c\u0426\u041a","distance":0.8},{"name":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f","line":"\u041a\u0430\u043b\u0443\u0436\u0441\u043a\u043e-\u0420\u0438\u0436\u0441\u043a\u0430\u044f","distance":1.5}],"divisions":{"administrative":{"area":null,"city":{"fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","kladr_id":"7700000000000","type":"\u0433","type_full":"\u0433\u043e\u0440\u043e\u0434","name":"\u041c\u043e\u0441\u043a\u0432\u0430","name_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430"},"settlement":null,"city_district":{"fias_id":null,"kladr_id":null,"type":"\u0440-\u043d","type_full":"\u0440\u0430\u0439\u043e\u043d","name":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439","name_with_type":"\u0410\u043a\u0430\u0434\u0435\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440-\u043d"}},"municipal":null},"qc_geo":"0","qc_complete":"5","qc_house":"2","history_values":null,"unparsed_parts":null,"source":"117997, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0412\u0430\u0432\u0438\u043b\u043e\u0432\u0430, 19","qc":"0"}},"phones":null}}]}', true); 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /tests/DaDataCompanyTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 23 | DaDataCompany::id('7707083893', 1, null, BranchType::MAIN, CompanyType::LEGAL), 24 | $this->OrganizationProvider() 25 | ); 26 | } 27 | 28 | /** 29 | * @test 30 | */ 31 | public function testPromptFromString() 32 | { 33 | $this->assertSame( 34 | DaDataCompany::prompt('сбербанк', 1, [CompanyStatus::ACTIVE], CompanyType::LEGAL), 35 | $this->OrganizationProvider() 36 | ); 37 | } 38 | 39 | /** 40 | * @return array|array[] 41 | */ 42 | public function OrganizationProvider() : array 43 | { 44 | return [ 45 | "suggestions" => [ 46 | 0 => [ 47 | "value" => "ПАО СБЕРБАНК", 48 | "unrestricted_value" => "ПАО СБЕРБАНК", 49 | "data" => [ 50 | "kpp" => "773601001", 51 | "capital" => null, 52 | "management" => [ 53 | "name" => "Греф Герман Оскарович", 54 | "post" => "ПРЕЗИДЕНТ, ПРЕДСЕДАТЕЛЬ ПРАВЛЕНИЯ", 55 | "disqualified" => null, 56 | ], 57 | "founders" => null, 58 | "managers" => null, 59 | "predecessors" => null, 60 | "successors" => null, 61 | "branch_type" => "MAIN", 62 | "branch_count" => 87, 63 | "source" => null, 64 | "qc" => null, 65 | "hid" => "588a141bc5e17cbc976ec2d0d54149af49d5a4ca16e26ed2effafdf06841d645", 66 | "type" => "LEGAL", 67 | "state" => [ 68 | "status" => "ACTIVE", 69 | "code" => null, 70 | "actuality_date" => 1650844800000, 71 | "registration_date" => 677376000000, 72 | "liquidation_date" => null, 73 | ], 74 | "opf" => [ 75 | "type" => "2014", 76 | "code" => "12247", 77 | "full" => "Публичное акционерное общество", 78 | "short" => "ПАО", 79 | ], 80 | "name" => [ 81 | "full_with_opf" => "ПУБЛИЧНОЕ АКЦИОНЕРНОЕ ОБЩЕСТВО \"СБЕРБАНК РОССИИ\"", 82 | "short_with_opf" => "ПАО СБЕРБАНК", 83 | "latin" => null, 84 | "full" => "СБЕРБАНК РОССИИ", 85 | "short" => "СБЕРБАНК", 86 | ], 87 | "inn" => "7707083893", 88 | "ogrn" => "1027700132195", 89 | "okpo" => "00032537", 90 | "okato" => "45293554000", 91 | "oktmo" => "45397000000", 92 | "okogu" => "4100104", 93 | "okfs" => "41", 94 | "okved" => "64.19", 95 | "okveds" => null, 96 | "authorities" => null, 97 | "documents" => null, 98 | "licenses" => null, 99 | "finance" => null, 100 | "address" => [ 101 | "value" => "г Москва, ул Вавилова, д 19", 102 | "unrestricted_value" => "117312, г Москва, Академический р-н, ул Вавилова, д 19", 103 | "data" => [ 104 | "postal_code" => "117312", 105 | "country" => "Россия", 106 | "country_iso_code" => "RU", 107 | "federal_district" => "Центральный", 108 | "region_fias_id" => "0c5b2444-70a0-4932-980c-b4dc0d3f02b5", 109 | "region_kladr_id" => "7700000000000", 110 | "region_iso_code" => "RU-MOW", 111 | "region_with_type" => "г Москва", 112 | "region_type" => "г", 113 | "region_type_full" => "город", 114 | "region" => "Москва", 115 | "area_fias_id" => null, 116 | "area_kladr_id" => null, 117 | "area_with_type" => null, 118 | "area_type" => null, 119 | "area_type_full" => null, 120 | "area" => null, 121 | "city_fias_id" => "0c5b2444-70a0-4932-980c-b4dc0d3f02b5", 122 | "city_kladr_id" => "7700000000000", 123 | "city_with_type" => "г Москва", 124 | "city_type" => "г", 125 | "city_type_full" => "город", 126 | "city" => "Москва", 127 | "city_area" => "Юго-западный", 128 | "city_district_fias_id" => null, 129 | "city_district_kladr_id" => null, 130 | "city_district_with_type" => "Академический р-н", 131 | "city_district_type" => "р-н", 132 | "city_district_type_full" => "район", 133 | "city_district" => "Академический", 134 | "settlement_fias_id" => null, 135 | "settlement_kladr_id" => null, 136 | "settlement_with_type" => null, 137 | "settlement_type" => null, 138 | "settlement_type_full" => null, 139 | "settlement" => null, 140 | "street_fias_id" => "25f8f29b-b110-40ab-a48e-9c72f5fb4331", 141 | "street_kladr_id" => "77000000000092400", 142 | "street_with_type" => "ул Вавилова", 143 | "street_type" => "ул", 144 | "street_type_full" => "улица", 145 | "street" => "Вавилова", 146 | "stead_fias_id" => null, 147 | "stead_cadnum" => null, 148 | "stead_type" => null, 149 | "stead_type_full" => null, 150 | "stead" => null, 151 | "house_fias_id" => "93409d8c-d8d4-4491-838f-f9aa1678b5e6", 152 | "house_kladr_id" => "7700000000009240170", 153 | "house_cadnum" => "77:06:0002008:1036", 154 | "house_type" => "д", 155 | "house_type_full" => "дом", 156 | "house" => "19", 157 | "block_type" => null, 158 | "block_type_full" => null, 159 | "block" => null, 160 | "entrance" => null, 161 | "floor" => null, 162 | "flat_fias_id" => null, 163 | "flat_cadnum" => null, 164 | "flat_type" => null, 165 | "flat_type_full" => null, 166 | "flat" => null, 167 | "flat_area" => null, 168 | "square_meter_price" => null, 169 | "flat_price" => null, 170 | "postal_box" => null, 171 | "fias_id" => "93409d8c-d8d4-4491-838f-f9aa1678b5e6", 172 | "fias_code" => "77000000000000009240170", 173 | "fias_level" => "8", 174 | "fias_actuality_state" => "0", 175 | "kladr_id" => "7700000000009240170", 176 | "geoname_id" => "524901", 177 | "capital_marker" => "0", 178 | "okato" => "45293554000", 179 | "oktmo" => "45397000", 180 | "tax_office" => "7736", 181 | "tax_office_legal" => "7736", 182 | "timezone" => "UTC+3", 183 | "geo_lat" => "55.7001865", 184 | "geo_lon" => "37.5802234", 185 | "beltway_hit" => "IN_MKAD", 186 | "beltway_distance" => null, 187 | "metro" => [ 188 | [ 189 | "name" => "Ленинский проспект", 190 | "line" => "Калужско-Рижская", 191 | "distance" => 0.8, 192 | ], [ 193 | "name" => "Площадь Гагарина", 194 | "line" => "МЦК", 195 | "distance" => 0.8, 196 | ], [ 197 | "name" => "Академическая", 198 | "line" => "Калужско-Рижская", 199 | "distance" => 1.5, 200 | ], 201 | ], 202 | "divisions" => [ 203 | "administrative" => [ 204 | "area" => null, 205 | "city" => [ 206 | "fias_id" => "0c5b2444-70a0-4932-980c-b4dc0d3f02b5", 207 | "kladr_id" => "7700000000000", 208 | "type" => "г", 209 | "type_full" => "город", 210 | "name" => "Москва", 211 | "name_with_type" => "г Москва", 212 | ], 213 | "settlement" => null, 214 | "city_district" => [ 215 | "fias_id" => null, 216 | "kladr_id" => null, 217 | "type" => "р-н", 218 | "type_full" => "район", 219 | "name" => "Академический", 220 | "name_with_type" => "Академический р-н", 221 | ], 222 | ], 223 | "municipal" => null, 224 | ], 225 | "qc_geo" => "0", 226 | "qc_complete" => null, 227 | "qc_house" => null, 228 | "history_values" => null, 229 | "unparsed_parts" => null, 230 | "source" => "117312, ГОРОД МОСКВА, УЛ. ВАВИЛОВА, Д.19", 231 | "qc" => "0", 232 | ], 233 | ], 234 | "phones" => null, 235 | "emails" => null, 236 | "ogrn_date" => 1029456000000, 237 | "okved_type" => "2014", 238 | "employee_count" => null, 239 | ], 240 | ], 241 | ], 242 | ]; 243 | } 244 | 245 | } 246 | -------------------------------------------------------------------------------- /tests/DaDataAddressTest.php: -------------------------------------------------------------------------------- 1 | assertSame( 16 | DaDataAddress::standardization('мск сухонска 11/-89'), 17 | $this->StandardizationAddressProvider() 18 | ); 19 | } 20 | 21 | /** 22 | * @test 23 | */ 24 | public function testPromptAddressFromString() 25 | { 26 | $this->assertSame( 27 | DaDataAddress::prompt('москва хабар', 2), 28 | $this->PromptAddressProvider() 29 | ); 30 | } 31 | 32 | /** 33 | * @test 34 | */ 35 | public function testGeolocationAddress() 36 | { 37 | $this->assertSame( 38 | DaDataAddress::geolocate(55.878, 37.653, 1), 39 | $this->GeolocationAddressProvider() 40 | ); 41 | } 42 | 43 | /** 44 | * @test 45 | */ 46 | public function testIpLocateAddress() 47 | { 48 | $this->assertSame( 49 | DaDataAddress::iplocate('46.226.227.20', 1), 50 | $this->Ipv4AddressProvider() 51 | ); 52 | } 53 | 54 | /** 55 | * @test 56 | */ 57 | public function testIdAddress() 58 | { 59 | $this->assertSame( 60 | DaDataAddress::id('9120b43f-2fae-4838-a144-85e43c2bfb29', 1), 61 | $this->IdAddressProvider() 62 | ); 63 | } 64 | 65 | /** 66 | * @test 67 | */ 68 | public function testGetPostalUnitByAddress() 69 | { 70 | $this->assertSame( 71 | DaDataAddress::postalUnitByAddress('дежнева 2а', 1), 72 | $this->PostalUnitByAddreessProvider() 73 | ); 74 | } 75 | 76 | /** 77 | * @test 78 | */ 79 | public function testGetPostalUnitById() 80 | { 81 | $this->assertSame( 82 | DaDataAddress::postalUnitById('127642', 1), 83 | $this->PostalUnitByAddreessProvider() 84 | ); 85 | } 86 | 87 | /** 88 | * @test 89 | */ 90 | public function testGetPostalUnitByGeoCoorinates() 91 | { 92 | $this->assertSame( 93 | DaDataAddress::postalUnitByGeoLocate(55.878, 37.653, 1000, 2), 94 | $this->PostalUnitByGeoCoordinatesProvider() 95 | ); 96 | } 97 | 98 | /** 99 | * @test 100 | */ 101 | public function testDeliveryAddress() 102 | { 103 | $this->assertSame( 104 | DaDataAddress::delivery('3100400100000'), 105 | $this->DeliveryProvider() 106 | ); 107 | } 108 | 109 | /** 110 | * @test 111 | */ 112 | public function testFiasAddress() 113 | { 114 | $this->assertSame( 115 | DaDataAddress::fias('9120b43f-2fae-4838-a144-85e43c2bfb29'), 116 | $this->FiasAddressProvider() 117 | ); 118 | } 119 | 120 | /** 121 | * @return array|\array[][] 122 | */ 123 | public function FiasAddressProvider() : array 124 | { 125 | return json_decode('{"suggestions":[{"value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0421\u043d\u0435\u0436\u043d\u0430\u044f","unrestricted_value":"129323, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0421\u043d\u0435\u0436\u043d\u0430\u044f","data":{"postal_code":"129323","region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":null,"city_kladr_id":null,"city_with_type":null,"city_type":null,"city_type_full":null,"city":null,"city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":null,"city_district_type":null,"city_district_type_full":null,"city_district":null,"settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"planning_structure_fias_id":null,"planning_structure_kladr_id":null,"planning_structure_with_type":null,"planning_structure_type":null,"planning_structure_type_full":null,"planning_structure":null,"street_fias_id":"9120b43f-2fae-4838-a144-85e43c2bfb29","street_kladr_id":"77000000000268400","street_with_type":"\u0443\u043b \u0421\u043d\u0435\u0436\u043d\u0430\u044f","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0421\u043d\u0435\u0436\u043d\u0430\u044f","house_fias_id":null,"house_kladr_id":null,"house_type":null,"house":null,"block":null,"building_type":null,"building":null,"fias_id":"9120b43f-2fae-4838-a144-85e43c2bfb29","fias_code":"7700000000000002684","fias_level":"7","fias_actuality_state":"0","kladr_id":"77000000000268400","capital_marker":"0","okato":"45280580000","oktmo":"45361000","cadastral_number":null,"tax_office":"7716","tax_office_legal":"7716","history_values":null,"source":null,"qc":null}}]}', true); 126 | } 127 | 128 | /** 129 | * @return array 130 | */ 131 | public function DeliveryProvider() : array 132 | { 133 | return json_decode('{"suggestions":[{"value":"3100400100000","unrestricted_value":"fe7eea4a-875a-4235-aa61-81c2a37a0440","data":{"kladr_id":"3100400100000","fias_id":"fe7eea4a-875a-4235-aa61-81c2a37a0440","boxberry_id":"01929","cdek_id":"344","dpd_id":"196006461"}}]}', true); 134 | } 135 | 136 | /** 137 | * @return array|\array[][] 138 | */ 139 | public function PostalUnitByGeoCoordinatesProvider() : array 140 | { 141 | return json_decode('{"suggestions":[{"value":"127642","unrestricted_value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u043f\u0440\u043e\u0435\u0437\u0434 \u0414\u0435\u0436\u043d\u0451\u0432\u0430, \u0434 2\u0410","data":{"postal_code":"127642","is_closed":false,"type_code":"\u0413\u041e\u041f\u0421","address_str":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u043f\u0440\u043e\u0435\u0437\u0434 \u0414\u0435\u0436\u043d\u0451\u0432\u0430, \u0434 2\u0410","address_kladr_id":"7700000000000","address_qc":"0","geo_lat":55.872142,"geo_lon":37.651035,"schedule_mon":"08:00-21:00","schedule_tue":"08:00-21:00","schedule_wed":"08:00-21:00","schedule_thu":"08:00-21:00","schedule_fri":"08:00-21:00","schedule_sat":"09:00-18:00","schedule_sun":"09:00-14:00"}},{"value":"127221","unrestricted_value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u041f\u043e\u043b\u044f\u0440\u043d\u0430\u044f, \u0434 16 \u043a 1","data":{"postal_code":"127221","is_closed":false,"type_code":"\u0413\u041e\u041f\u0421","address_str":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u041f\u043e\u043b\u044f\u0440\u043d\u0430\u044f, \u0434 16 \u043a 1","address_kladr_id":"7700000000000","address_qc":"0","geo_lat":55.876612,"geo_lon":37.637317,"schedule_mon":"08:00-20:00","schedule_tue":"08:00-20:00","schedule_wed":"08:00-20:00","schedule_thu":"08:00-20:00","schedule_fri":"08:00-20:00","schedule_sat":"09:00-18:00","schedule_sun":null}}]}', true); 142 | } 143 | 144 | /** 145 | * @return array|array[] 146 | */ 147 | public function PostalUnitByAddreessProvider() : array 148 | { 149 | return json_decode('{"suggestions":[{"value":"127642","unrestricted_value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u043f\u0440\u043e\u0435\u0437\u0434 \u0414\u0435\u0436\u043d\u0451\u0432\u0430, \u0434 2\u0410","data":{"postal_code":"127642","is_closed":false,"type_code":"\u0413\u041e\u041f\u0421","address_str":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u043f\u0440\u043e\u0435\u0437\u0434 \u0414\u0435\u0436\u043d\u0451\u0432\u0430, \u0434 2\u0410","address_kladr_id":"7700000000000","address_qc":"0","geo_lat":55.872142,"geo_lon":37.651035,"schedule_mon":"08:00-21:00","schedule_tue":"08:00-21:00","schedule_wed":"08:00-21:00","schedule_thu":"08:00-21:00","schedule_fri":"08:00-21:00","schedule_sat":"09:00-18:00","schedule_sun":"09:00-14:00"}}]}', true); 150 | } 151 | 152 | /** 153 | * @return array 154 | */ 155 | public function IdAddressProvider() : array 156 | { 157 | return json_decode('{"suggestions":[{"value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0421\u043d\u0435\u0436\u043d\u0430\u044f","unrestricted_value":"129323, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0440-\u043d \u0421\u0432\u0438\u0431\u043b\u043e\u0432\u043e, \u0443\u043b \u0421\u043d\u0435\u0436\u043d\u0430\u044f","data":{"postal_code":"129323","country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":"\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439","region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_iso_code":"RU-MOW","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","city_kladr_id":"7700000000000","city_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","city_type":"\u0433","city_type_full":"\u0433\u043e\u0440\u043e\u0434","city":"\u041c\u043e\u0441\u043a\u0432\u0430","city_area":"\u0421\u0435\u0432\u0435\u0440\u043e-\u0432\u043e\u0441\u0442\u043e\u0447\u043d\u044b\u0439","city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":"\u0440-\u043d \u0421\u0432\u0438\u0431\u043b\u043e\u0432\u043e","city_district_type":"\u0440-\u043d","city_district_type_full":"\u0440\u0430\u0439\u043e\u043d","city_district":"\u0421\u0432\u0438\u0431\u043b\u043e\u0432\u043e","settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":"9120b43f-2fae-4838-a144-85e43c2bfb29","street_kladr_id":"77000000000268400","street_with_type":"\u0443\u043b \u0421\u043d\u0435\u0436\u043d\u0430\u044f","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0421\u043d\u0435\u0436\u043d\u0430\u044f","stead_fias_id":null,"stead_cadnum":null,"stead_type":null,"stead_type_full":null,"stead":null,"house_fias_id":null,"house_kladr_id":null,"house_cadnum":null,"house_type":null,"house_type_full":null,"house":null,"block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":null,"flat_cadnum":null,"flat_type":null,"flat_type_full":null,"flat":null,"flat_area":null,"square_meter_price":null,"flat_price":null,"postal_box":null,"fias_id":"9120b43f-2fae-4838-a144-85e43c2bfb29","fias_code":"7700000000000002684","fias_level":"7","fias_actuality_state":"0","kladr_id":"77000000000268400","geoname_id":"524901","capital_marker":"0","okato":"45280580000","oktmo":"45361000","tax_office":"7716","tax_office_legal":"7716","timezone":null,"geo_lat":"55.852405","geo_lon":"37.646947","beltway_hit":null,"beltway_distance":null,"metro":null,"divisions":null,"qc_geo":"2","qc_complete":null,"qc_house":null,"history_values":null,"unparsed_parts":null,"source":null,"qc":null}}]}', true); 158 | } 159 | 160 | /** 161 | * @return array|array[] 162 | */ 163 | public function Ipv4AddressProvider() : array 164 | { 165 | return json_decode('{"location":{"value":"\u0433 \u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440","unrestricted_value":"350000, \u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440\u0441\u043a\u0438\u0439 \u043a\u0440\u0430\u0439, \u0433 \u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440","data":{"postal_code":"350000","country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":"\u042e\u0436\u043d\u044b\u0439","region_fias_id":"d00e1013-16bd-4c09-b3d5-3cb09fc54bd8","region_kladr_id":"2300000000000","region_iso_code":"RU-KDA","region_with_type":"\u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440\u0441\u043a\u0438\u0439 \u043a\u0440\u0430\u0439","region_type":"\u043a\u0440\u0430\u0439","region_type_full":"\u043a\u0440\u0430\u0439","region":"\u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440\u0441\u043a\u0438\u0439","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":"7dfa745e-aa19-4688-b121-b655c11e482f","city_kladr_id":"2300000100000","city_with_type":"\u0433 \u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440","city_type":"\u0433","city_type_full":"\u0433\u043e\u0440\u043e\u0434","city":"\u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440","city_area":null,"city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":null,"city_district_type":null,"city_district_type_full":null,"city_district":null,"settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":null,"street_kladr_id":null,"street_with_type":null,"street_type":null,"street_type_full":null,"street":null,"stead_fias_id":null,"stead_cadnum":null,"stead_type":null,"stead_type_full":null,"stead":null,"house_fias_id":null,"house_kladr_id":null,"house_cadnum":null,"house_type":null,"house_type_full":null,"house":null,"block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":null,"flat_cadnum":null,"flat_type":null,"flat_type_full":null,"flat":null,"flat_area":null,"square_meter_price":null,"flat_price":null,"postal_box":null,"fias_id":"7dfa745e-aa19-4688-b121-b655c11e482f","fias_code":"2300000100000000000","fias_level":"4","fias_actuality_state":"0","kladr_id":"2300000100000","geoname_id":"542420","capital_marker":"2","okato":"03401000000","oktmo":"03701000001","tax_office":"2300","tax_office_legal":"2300","timezone":null,"geo_lat":"45.040216","geo_lon":"38.975996","beltway_hit":null,"beltway_distance":null,"metro":null,"divisions":null,"qc_geo":"4","qc_complete":null,"qc_house":null,"history_values":null,"unparsed_parts":null,"source":null,"qc":null}}}', true); 166 | } 167 | 168 | /** 169 | * @return array|\array[][] 170 | */ 171 | public function GeolocationAddressProvider() : array 172 | { 173 | return json_decode('{"suggestions":[{"value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0421\u0443\u0445\u043e\u043d\u0441\u043a\u0430\u044f, \u0434 11","unrestricted_value":"127642, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0440-\u043d \u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u041c\u0435\u0434\u0432\u0435\u0434\u043a\u043e\u0432\u043e, \u0443\u043b \u0421\u0443\u0445\u043e\u043d\u0441\u043a\u0430\u044f, \u0434 11","data":{"postal_code":"127642","country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":"\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439","region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_iso_code":"RU-MOW","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","city_kladr_id":"7700000000000","city_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","city_type":"\u0433","city_type_full":"\u0433\u043e\u0440\u043e\u0434","city":"\u041c\u043e\u0441\u043a\u0432\u0430","city_area":"\u0421\u0435\u0432\u0435\u0440\u043e-\u0432\u043e\u0441\u0442\u043e\u0447\u043d\u044b\u0439","city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":"\u0440-\u043d \u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u041c\u0435\u0434\u0432\u0435\u0434\u043a\u043e\u0432\u043e","city_district_type":"\u0440-\u043d","city_district_type_full":"\u0440\u0430\u0439\u043e\u043d","city_district":"\u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u041c\u0435\u0434\u0432\u0435\u0434\u043a\u043e\u0432\u043e","settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":"95dbf7fb-0dd4-4a04-8100-4f6c847564b5","street_kladr_id":"77000000000283600","street_with_type":"\u0443\u043b \u0421\u0443\u0445\u043e\u043d\u0441\u043a\u0430\u044f","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0421\u0443\u0445\u043e\u043d\u0441\u043a\u0430\u044f","stead_fias_id":null,"stead_cadnum":null,"stead_type":null,"stead_type_full":null,"stead":null,"house_fias_id":"5ee84ac0-eb9a-4b42-b814-2f5f7c27c255","house_kladr_id":"7700000000028360004","house_cadnum":null,"house_type":"\u0434","house_type_full":"\u0434\u043e\u043c","house":"11","block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":null,"flat_cadnum":null,"flat_type":null,"flat_type_full":null,"flat":null,"flat_area":null,"square_meter_price":null,"flat_price":null,"postal_box":null,"fias_id":"5ee84ac0-eb9a-4b42-b814-2f5f7c27c255","fias_code":"77000000000000028360004","fias_level":"8","fias_actuality_state":"0","kladr_id":"7700000000028360004","geoname_id":"524901","capital_marker":"0","okato":"45280583000","oktmo":"45362000","tax_office":"7715","tax_office_legal":"7715","timezone":null,"geo_lat":"55.878315","geo_lon":"37.65372","beltway_hit":null,"beltway_distance":null,"metro":null,"divisions":null,"qc_geo":"0","qc_complete":null,"qc_house":null,"history_values":null,"unparsed_parts":null,"source":null,"qc":null}}]}', true); 174 | } 175 | 176 | /** 177 | * @return array|\array[][] 178 | */ 179 | public function PromptAddressProvider() : array 180 | { 181 | return json_decode('{"suggestions":[{"value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0441\u043a\u0430\u044f","unrestricted_value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0441\u043a\u0430\u044f","data":{"postal_code":null,"country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":null,"region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_iso_code":"RU-MOW","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","city_kladr_id":"7700000000000","city_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","city_type":"\u0433","city_type_full":"\u0433\u043e\u0440\u043e\u0434","city":"\u041c\u043e\u0441\u043a\u0432\u0430","city_area":null,"city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":null,"city_district_type":null,"city_district_type_full":null,"city_district":null,"settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":"32fcb102-2a50-44c9-a00e-806420f448ea","street_kladr_id":"77000000000713400","street_with_type":"\u0443\u043b \u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0441\u043a\u0430\u044f","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0441\u043a\u0430\u044f","stead_fias_id":null,"stead_cadnum":null,"stead_type":null,"stead_type_full":null,"stead":null,"house_fias_id":null,"house_kladr_id":null,"house_cadnum":null,"house_type":null,"house_type_full":null,"house":null,"block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":null,"flat_cadnum":null,"flat_type":null,"flat_type_full":null,"flat":null,"flat_area":null,"square_meter_price":null,"flat_price":null,"postal_box":null,"fias_id":"32fcb102-2a50-44c9-a00e-806420f448ea","fias_code":"7700000000000007134","fias_level":"7","fias_actuality_state":"0","kladr_id":"77000000000713400","geoname_id":"524901","capital_marker":"0","okato":"45263564000","oktmo":"45305000","tax_office":"7718","tax_office_legal":"7718","timezone":null,"geo_lat":"55.821168","geo_lon":"37.82608","beltway_hit":null,"beltway_distance":null,"metro":null,"divisions":null,"qc_geo":"2","qc_complete":null,"qc_house":null,"history_values":["\u0443\u043b \u0427\u0435\u0440\u043d\u0435\u043d\u043a\u043e"],"unparsed_parts":null,"source":null,"qc":null}},{"value":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u043f\u043e\u0441\u0435\u043b\u0435\u043d\u0438\u0435 \u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439, \u0433 \u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439, \u0443\u043b \u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0430","unrestricted_value":"108811, \u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u043f\u043e\u0441\u0435\u043b\u0435\u043d\u0438\u0435 \u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439, \u0433 \u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439, \u0443\u043b \u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0430","data":{"postal_code":"108811","country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":null,"region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_iso_code":"RU-MOW","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":"762758bb-18b9-440f-bc61-8e1e77ff3fd8","area_kladr_id":"7701100000000","area_with_type":"\u043f\u043e\u0441\u0435\u043b\u0435\u043d\u0438\u0435 \u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439","area_type":"\u043f","area_type_full":"\u043f\u043e\u0441\u0435\u043b\u0435\u043d\u0438\u0435","area":"\u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439","city_fias_id":"fbcf1fff-1d7c-445e-ad92-b71c08b8aba3","city_kladr_id":"7701100200000","city_with_type":"\u0433 \u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439","city_type":"\u0433","city_type_full":"\u0433\u043e\u0440\u043e\u0434","city":"\u041c\u043e\u0441\u043a\u043e\u0432\u0441\u043a\u0438\u0439","city_area":null,"city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":null,"city_district_type":null,"city_district_type_full":null,"city_district":null,"settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":"4d70a35d-9246-4d9c-bcf1-90812ad056a3","street_kladr_id":"77011002000003700","street_with_type":"\u0443\u043b \u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0430","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0425\u0430\u0431\u0430\u0440\u043e\u0432\u0430","stead_fias_id":null,"stead_cadnum":null,"stead_type":null,"stead_type_full":null,"stead":null,"house_fias_id":null,"house_kladr_id":null,"house_cadnum":null,"house_type":null,"house_type_full":null,"house":null,"block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":null,"flat_cadnum":null,"flat_type":null,"flat_type_full":null,"flat":null,"flat_area":null,"square_meter_price":null,"flat_price":null,"postal_box":null,"fias_id":"4d70a35d-9246-4d9c-bcf1-90812ad056a3","fias_code":"7701100200000000037","fias_level":"7","fias_actuality_state":"0","kladr_id":"77011002000003700","geoname_id":"857690","capital_marker":"0","okato":"45297565001","oktmo":"45952000","tax_office":"7751","tax_office_legal":"7751","timezone":null,"geo_lat":"55.59483","geo_lon":"37.35963","beltway_hit":null,"beltway_distance":null,"metro":null,"divisions":null,"qc_geo":"2","qc_complete":null,"qc_house":null,"history_values":null,"unparsed_parts":null,"source":null,"qc":null}}]}', true); 182 | } 183 | 184 | /** 185 | * @return array|array[] 186 | **/ 187 | public function StandardizationAddressProvider() : array 188 | { 189 | return json_decode('[{"source":"\u043c\u0441\u043a \u0441\u0443\u0445\u043e\u043d\u0441\u043a\u0430 11\/-89","result":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430, \u0443\u043b \u0421\u0443\u0445\u043e\u043d\u0441\u043a\u0430\u044f, \u0434 11, \u043a\u0432 89","postal_code":"127642","country":"\u0420\u043e\u0441\u0441\u0438\u044f","country_iso_code":"RU","federal_district":"\u0426\u0435\u043d\u0442\u0440\u0430\u043b\u044c\u043d\u044b\u0439","region_fias_id":"0c5b2444-70a0-4932-980c-b4dc0d3f02b5","region_kladr_id":"7700000000000","region_iso_code":"RU-MOW","region_with_type":"\u0433 \u041c\u043e\u0441\u043a\u0432\u0430","region_type":"\u0433","region_type_full":"\u0433\u043e\u0440\u043e\u0434","region":"\u041c\u043e\u0441\u043a\u0432\u0430","area_fias_id":null,"area_kladr_id":null,"area_with_type":null,"area_type":null,"area_type_full":null,"area":null,"city_fias_id":null,"city_kladr_id":null,"city_with_type":null,"city_type":null,"city_type_full":null,"city":null,"city_area":"\u0421\u0435\u0432\u0435\u0440\u043e-\u0432\u043e\u0441\u0442\u043e\u0447\u043d\u044b\u0439","city_district_fias_id":null,"city_district_kladr_id":null,"city_district_with_type":"\u0440-\u043d \u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u041c\u0435\u0434\u0432\u0435\u0434\u043a\u043e\u0432\u043e","city_district_type":"\u0440-\u043d","city_district_type_full":"\u0440\u0430\u0439\u043e\u043d","city_district":"\u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u041c\u0435\u0434\u0432\u0435\u0434\u043a\u043e\u0432\u043e","settlement_fias_id":null,"settlement_kladr_id":null,"settlement_with_type":null,"settlement_type":null,"settlement_type_full":null,"settlement":null,"street_fias_id":"95dbf7fb-0dd4-4a04-8100-4f6c847564b5","street_kladr_id":"77000000000283600","street_with_type":"\u0443\u043b \u0421\u0443\u0445\u043e\u043d\u0441\u043a\u0430\u044f","street_type":"\u0443\u043b","street_type_full":"\u0443\u043b\u0438\u0446\u0430","street":"\u0421\u0443\u0445\u043e\u043d\u0441\u043a\u0430\u044f","house_fias_id":"5ee84ac0-eb9a-4b42-b814-2f5f7c27c255","house_kladr_id":"7700000000028360004","house_type":"\u0434","house_type_full":"\u0434\u043e\u043c","house":"11","block_type":null,"block_type_full":null,"block":null,"entrance":null,"floor":null,"flat_fias_id":"f26b876b-6857-4951-b060-ec6559f04a9a","flat_type":"\u043a\u0432","flat_type_full":"\u043a\u0432\u0430\u0440\u0442\u0438\u0440\u0430","flat":"89","flat_area":"34.6","square_meter_price":"214887","flat_price":"7435091","postal_box":null,"fias_id":"f26b876b-6857-4951-b060-ec6559f04a9a","fias_code":"77000000000000028360004","fias_level":"9","fias_actuality_state":"0","kladr_id":"7700000000028360004","capital_marker":"0","okato":"45280583000","oktmo":"45362000","tax_office":"7715","tax_office_legal":"7715","timezone":"UTC+3","geo_lat":"55.8782557","geo_lon":"37.65372","beltway_hit":"IN_MKAD","beltway_distance":null,"qc_geo":0,"qc_complete":0,"qc_house":2,"qc":0,"unparsed_parts":null,"metro":[{"distance":1.1,"line":"\u041a\u0430\u043b\u0443\u0436\u0441\u043a\u043e-\u0420\u0438\u0436\u0441\u043a\u0430\u044f","name":"\u0411\u0430\u0431\u0443\u0448\u043a\u0438\u043d\u0441\u043a\u0430\u044f"},{"distance":1.2,"line":"\u041a\u0430\u043b\u0443\u0436\u0441\u043a\u043e-\u0420\u0438\u0436\u0441\u043a\u0430\u044f","name":"\u041c\u0435\u0434\u0432\u0435\u0434\u043a\u043e\u0432\u043e"},{"distance":2.5,"line":"\u041a\u0430\u043b\u0443\u0436\u0441\u043a\u043e-\u0420\u0438\u0436\u0441\u043a\u0430\u044f","name":"\u0421\u0432\u0438\u0431\u043b\u043e\u0432\u043e"}]}]', true); 190 | } 191 | 192 | } 193 | --------------------------------------------------------------------------------