PHP code example of coolycow / laravel-dadata

1. Go to this page and download the library: Download coolycow/laravel-dadata library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

coolycow / laravel-dadata example snippets


  Coolycow\Dadata\DadataServiceProvider::class,

$app->withFacades();

    'token' => env('DADATA_TOKEN', ''),
    'secret' => env('DADATA_SECRET', ''),

use Coolycow\Dadata\Facades\DadataSuggest;

$result = DadataSuggest::suggest("address", ["query"=>"Москва", "count"=>2]);
print_r($result);

$result = DadataSuggest::partyById('5077746329876', ["branch_type"=>"MAIN"]);
print_r($result);

use Coolycow\Dadata\Facades\DadataClean;

$response = DadataClean::cleanAddress('мск сухонска 11/-89');
$response = DadataClean::cleanPhone('тел 7165219 доб139');
$response = DadataClean::cleanPassport('4509 235857');
$response = DadataClean::cleanName('Срегей владимерович иванов');
$response = DadataClean::cleanEmail('serega@yandex/ru');
$response = DadataClean::cleanDate('24/3/12');
$response = DadataClean::cleanVehicle('форд фокус');
$response = DadataClean::getStatistics();
$response = DadataClean::getStatistics(now()->subDays(6));
print_r($response);

$response = DadataClean::getBalance();

$response = DadataClean::getStatistics();

$response = DadataClean::getStatistics(now()->subDays(6));
// or
$response = DadataClean::getStatistics('2022-12-01');
bash
php artisan vendor:publish --provider="Coolycow\Dadata\DadataServiceProvider"