Download the PHP package glook/dadata-php-sdk without Composer
On this page you can find all versions of the php package glook/dadata-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download glook/dadata-php-sdk
More information about glook/dadata-php-sdk
Files in glook/dadata-php-sdk
Package dadata-php-sdk
Short Description Typed PHP SDK for Dadata API generated from OpenAPI schemas.
License MIT
Informations about the package dadata-php-sdk
Dadata Php SDK
Typed PHP SDK for Dadata API generated from OpenAPI schemas.
The package exposes two generated clients:
Glook\Dadata\Generated\Suggestions\Clientfor Suggestions API.Glook\Dadata\Generated\Clear\Clientfor Cleaner API.
For normal usage, create clients through the package factories instead of wiring HTTP clients and authentication plugins by hand.
Installation
Requirements:
- PHP 7.4 or newer
ext-json- A PSR-18 HTTP client available through
php-http/discovery
If your application does not already provide a PSR-18 client, install one explicitly:
Authentication
Dadata requires an API token and a secret key.
The factories add both generated authentication plugins automatically:
You only need to pass raw credentials:
HTTP Plugins
Factories accept an optional list of extra Http\Client\Common\Plugin instances.
Authentication is always registered first, then your plugins are appended.
This is the recommended extension point for retries, logging, caching, tracing, rate limiting, custom headers, and framework-specific integrations.
Fetch Modes
Generated methods return typed model objects by default:
To get the raw PSR-7 response instead, pass Client::FETCH_RESPONSE:
Suggestions API
Create a Suggestions client:
Suggest Address
Suggest Address in English
Find Address by FIAS or KLADR ID
Reverse Geocode Address
Find Company by INN
Find by INN and KPP:
Suggest Company
Suggest Bank
Suggest Email
Suggestions Methods
| Method | Dadata area |
|---|---|
suggestAddress(SuggestAddressRequest $request) |
Address suggestions |
suggestParty(SuggestPartyRequest $request) |
Company suggestions |
suggestBank(SuggestBankRequest $request) |
Bank suggestions |
suggestEmail(SuggestRequest $request) |
Email suggestions |
suggestFio(SuggestFioRequest $request) |
Personal name suggestions |
suggestFias(SuggestFiasRequest $request) |
FIAS suggestions |
suggestOutward(string $name, SuggestOutwardRequest $request) |
Generic suggest endpoint |
findByIdAddress(FindAddressByIdRequest $request) |
Find address by ID |
findByIdParty(FindPartyByIdRequest $request) |
Find company by INN/OGRN |
findByIdBank(FindBankByIdRequest $request) |
Find bank by BIC, SWIFT, INN, or registration number |
findByIdFias(FindFiasByIdRequest $request) |
Find address strictly by FIAS |
findByIdDelivery(SuggestRequest $request) |
Delivery city IDs |
findByEmailCompany(SuggestRequest $request) |
Find company by email |
findAffiliatedParty(FindAffiliatedPartyRequest $request) |
Find affiliated companies |
geoLocateAddress(GeoLocateAddressRequest $request) |
Reverse geocode address |
geoLocateOutward(string $name, GeoLocateOutwardRequest $request) |
Generic geolocate endpoint |
ipLocateAddress(IpLocateAddressRequest $request) |
GeoIP address lookup |
findByIdOutward(string $name, SuggestRequest $request) |
Generic find-by-id endpoint |
Cleaner API
Create a Cleaner client:
Clean Address
Cleaner methods accept arrays of strings and return arrays of typed result models.
Clean Name
Clean Phone
Clean Email
Clean Composite Record
Use cleanRecord() when one input row contains multiple fields.
Cleaner Methods
| Method | Dadata area |
|---|---|
cleanAddress(array $values) |
Address cleansing and geocoding |
cleanName(array $values) |
Personal name cleansing |
cleanPhone(array $values) |
Phone cleansing |
cleanEmail(array $values) |
Email cleansing |
cleanBirthdate(array $values) |
Birthdate cleansing |
cleanPassport(array $values) |
Passport cleansing |
cleanVehicle(array $values) |
Vehicle cleansing |
cleanAsIs(array $values) |
Return values without cleansing |
cleanRecord(RecordString $request) |
Composite record cleansing |
Error Handling
Generated methods throw UnexpectedStatusCodeException when Dadata returns an unexpected HTTP status code.
For Cleaner API imports, use Glook\Dadata\Generated\Clear\Exception\UnexpectedStatusCodeException.
Project Structure
src/contains hand-written public entry points.generated/contains JanePHP-generated SDK code and is committed to the package.schemas/contains OpenAPI schemas used for generation.config/contains JanePHP generator configuration.
Development
Install dependencies:
Run checks:
Run unit tests:
Regenerate clients from schemas:
Generate only one client:
After generation, review generated code and commit it together with schema/config changes.
License
MIT
All versions of dadata-php-sdk with dependencies
ext-json Version *
jane-php/open-api-runtime Version ^6.3 || ^7.0
symfony/serializer Version ^4.4 || ^5.0 || ^6.0
nyholm/psr7 Version ^1.8
psr/http-client Version ^1.0
psr/http-message Version ^1.0
psr/http-factory Version ^1.0
php-http/discovery Version ^1.14
php-http/client-common Version ^2.0
php-http/httplug Version ^2.0