movemoveapp / laravel-dadata2
A Laravel SDK for interacting with the DaData API, providing seamless integration for address validation, data enrichment, and other data processing features.
Requires
- php: ^8.0|^8.1|^8.2|^8.3|^8.4
- ext-json: *
- guzzlehttp/guzzle: ^7.5.1
- guzzlehttp/psr7: ^2.5
README
DaData is an SDK designed to facilitate easy interaction with the DaData API, allowing seamless integration of DaData functionalities within your Laravel applications. This package supports address and company data management for Russia, Belarus, and Kazakhstan. movemoveapp/laravel-dadata2
is the second version of the original movemoveapp/laravel-dadata package, built with a new and improved approach.
This version addresses a wide range of bugs and issues discovered in the first release, offering a more stable and maintainable integration with the DaData API.
Note
The original movemoveapp/laravel-dadata package is no longer maintained and should not be used in new projects.
Features
- Easy integration with the DaData API.
- Support for handling addresses and company data across Russia, Belarus, and Kazakhstan.
- Compatible with Laravel 10 and 11, PHP version 8.
Installation
Install the package via Composer:
composer require movemoveapp/laravel-dadata2
Register the Service Provider
After installing the package, you need to register the DaData service provider.
Up to and including Laravel 10, add the following line to the providers array in your config/app.php
file:
... 'providers' => [ ... MoveMoveApp\DaData\DaDataServiceProvider::class, ... ]
From Laravel versions 11 and above, you may edit bootstrap/providers.php
file:
<?php return [ ... MoveMoveApp\DaData\DaDataServiceProvider::class, ];
Publish the Configuration
After installation, publish the configuration file to set up the package with Laravel:
php artisan vendor:publish --provider='MoveMoveApp\DaData\DaDataServiceProvider'
Configuration
Once the configuration file is published, you can set up your DaData credentials in your .env
file. Obtain your API key and secret key from the DaData dashboard and set them as follows:
... DADATA_KEY=your_dadata_api_key_here DADATA_SECRET_KEY=your_dadata_secret_key_here
These keys will allow your application to authenticate requests to the DaData API.
API
Organization
This facade provides powerful tools to search, validate, and autocomplete Russian legal entities and individual entrepreneurs (IEs) based on data from the official Russian registries (EGRUL and EGRIP).
It helps to:
- Autocomplete company names, INNs, or addresses while typing;
- Narrow results by region, status, type, or industry (OKVED);
- Speed up user input and reduce errors in forms or business logic;
- Get full company details (registration data, address, management, etc.).
- Perfect for autofill scenarios, client onboarding forms, or integration with enterprise directories.
Organization Suggestion
Use this facade to search and autocomplete legal entities and individual entrepreneurs by name, INN, OGRN, address, or director name.
Basic Usage
use MoveMoveApp\DaData\Facades\DaDataOrganization; DaDataOrganization::suggestOrganization([ 'query' => 'мувмув' ]);
Supported Parameters
Parameter | Type | Description |
---|---|---|
query |
string | Search string (required). Could be a name, INN, OGRN, address, etc. |
count |
integer | Max number of results to return (default: 10, max: 20). |
type |
string | Organization type: LEGAL (legal entity) or INDIVIDUAL (entrepreneur). |
status |
array | Filter by status: ACTIVE , LIQUIDATING , LIQUIDATED , BANKRUPT , etc. |
okved |
string | Filter by OKVED code (business activity code). |
locations |
array | Filter results by location (e.g. region, city). |
locations_boost |
array | Prioritize results in certain locations. |
Example with Advanced Filters
DaDataOrganization::suggestOrganization([ 'query' => 'авто', 'count' => 5, 'type' => 'LEGAL', 'status' => ['ACTIVE'], 'okved' => '45.11', 'locations' => [['region' => 'Москва']], 'locations_boost' => [['region' => 'Москва']] ]);
Docs
Find Russian Organization
Use this method to retrieve exact information about a Russian company or individual entrepreneur by INN, OGRN, or full name. Unlike the general suggestions, this method performs a precise match and returns full organization data — perfect for backend checks, form validation, or compliance workflows.
use MoveMoveApp\DaData\Facades\DaDataOrganization; DaDataOrganization::findRussianOrganization([ 'query' => (string) $innOrOgrn, 'count' => (int) $limit, // optional, default 1 'kpp' => (string) $kpp, // optional 'branch_type' => 'MAIN'|'BRANCH', // optional 'type' => 'LEGAL'|'INDIVIDUAL', // optional 'status' => ['ACTIVE', 'LIQUIDATED'], // optional ]);
Supported Parameters
Parameter | Type | Description |
---|---|---|
query |
string |
Required. INN, OGRN, or full name of the legal entity or sole trader. |
count |
integer |
Number of results to return (default: 1, max: 20). |
kpp |
string |
KPP code — helps narrow down the branch when searching by INN. |
branch_type |
string |
Branch type: MAIN (head office), BRANCH (subsidiary/branch). |
type |
string |
Organization type: LEGAL (legal entity), INDIVIDUAL (sole proprietor). |
status |
array |
Filter by organization status: ACTIVE , LIQUIDATED , LIQUIDATING , etc. |
Docs
Cleaner Methods
The following data types can be standardized (cleaned):
Address Standardization
use MoveMoveApp\DaData\Facades\DaDataCleaner; DaDataCleaner::address('Красная площадь, дом 1');
Features:
- Parses full address into structured fields (region, city, street, house, flat)
- Provides postal code using Russian Post data
- Identifies coordinates (geocoding)
- Detects district, metro station, apartment price and area
- Returns KLADR, FIAS (GAR), OKATO, OKTMO, and tax office codes
- Identifies cadastral number (Russia only)
Docs
Name Standardization
use MoveMoveApp\DaData\Facades\DaDataCleaner; DaDataCleaner::name('иванов иван');
Features:
- Fixes typos and transliteration
- Detects gender
- Provides grammatical inflection
Docs
Phone Standardization
use MoveMoveApp\DaData\Facades\DaDataCleaner; DaDataCleaner::phone('+7 (999) 123-45-67');
Features:
- Validates phone number
- Corrects city code (DEF-code)
- Determines mobile operator (with MNP support)
- Detects country, region, city, timezone
Docs
Passport Standardization
⚠️ Note: Due to issues with the МВД database, data is current as of June 21, 2023.
use MoveMoveApp\DaData\Facades\DaDataCleaner; DaDataCleaner::passport('1234 567890');
Features:
- Validates format
- Checks against invalid passports registry
Docs
Email Standardization
use MoveMoveApp\DaData\Facades\DaDataCleaner; DaDataCleaner::email('ivan@yande.ru');
Features:
- Validates email format
- Fixes common typos
- Detects disposable emails
- Classifies as personal, corporate, or role-based
Docs
Vehicle Standardization
use MoveMoveApp\DaData\Facades\DaDataCleaner; DaDataCleaner::vehicle('Форд Фокус');
Features:
- Recognizes car make and model
Docs
Suggestion Methods
Use this facade to implement autocomplete features in forms or UIs. All methods require a query key in the input array.
Name Suggestion
use MoveMoveApp\DaData\Facades\DaDataSuggestions; DaDataSuggestions::name(['query' => 'иван']);
Features:
- Helps users quickly enter full names in forms
- Suggests surname, first name, and patronymic combinations
- Detects gender
Docs
Passport Unit Suggestion
use MoveMoveApp\DaData\Facades\DaDataSuggestions; DaDataSuggestions::passport(['query' => '770-']);
Features:
- Suggests issuing authorities for Russian passports
- Supports autocomplete for FMS unit codes
Docs
Email Suggestion
use MoveMoveApp\DaData\Facades\DaDataSuggestions; DaDataSuggestions::email(['query' => 'ivan@yand']);
Features:
- Autocompletes email addresses based on popular domains
- Useful for form inputs with typo correction
Docs
Car Brand Suggestion
use MoveMoveApp\DaData\Facades\DaDataSuggestions; DaDataSuggestions::carBrand(['query' => 'фо']);
Features:
- Suggests car makes and models
- Useful for auto-selection interfaces
Docs
Bank Suggestion
use MoveMoveApp\DaData\Facades\DaDataSuggestions; DaDataSuggestions::bank(['query' => 'сбербанк']);
Features:
- Suggests banks by name, BIK, SWIFT, INN, or correspondent account
- Returns complete bank info (address, status, license)
Docs
Bank Lookup by ID
use MoveMoveApp\DaData\Facades\DaDataSuggestions; DaDataSuggestions::bankById(['query' => '044525225']);
Features:
- Searches bank by exact BIK, SWIFT, INN, or correspondent account
- Use when you already have the identifier, not for autocomplete