Skip to content

v2.0.3

Latest

Choose a tag to compare

@pipisco pipisco released this 13 Jul 16:12

New Features

Support for Phone Number and Postal Code Standardization: We've introduced new methods for standardizing phone numbers and postal codes, enhancing data accuracy and usability.

SDK Core Update

The SDK core has been updated to better integrate with DaData's responses. All dictionaries returned from DaData are now converted to Enums, simplifying the code and eliminating the need for string checks.

Enum Implementation:

The first method to utilize Enums is the phone standardization method. In the Phone\Phone object, the type field (see https://dadata.ru/api/clean/phone/ under "Тип телефона") now uses the PhoneType Enum.

Code Example:

use MoveMoveApp\DaData2\Facades\DaDataPhone;

...

$data = DaDataPhone::clean((string) $query);
$phones = [];

foreach ($data as $suggestions) {
    $phones[] = [
        $this->phoneValue($suggestions),
        $suggestions->country_code,
        $suggestions->city_code,
        $suggestions->number,
        $suggestions->type ? $suggestions->type->name : null,
        $suggestions->type ? $suggestions->type->value : null,
    ];
}

In the $suggestions->type->name, you receive the name, and $suggestions->type->value provides the name in Russian as returned by DaData.

This update aims to streamline your development process and enhance your application's functionality with robust, reliable data handling.