PHP code example of deniskraev / laravel-dadata

1. Go to this page and download the library: Download deniskraev/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/ */

    

deniskraev / laravel-dadata example snippets


  Fomvasss\Dadata\DadataServiceProvider::class,

$app->withFacades();

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

use Fomvasss\Dadata\Facades\DadataSuggest;

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

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

use Fomvasss\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('2019-11-01');
bash
php artisan vendor:publish --provider="Fomvasss\Dadata\DadataServiceProvider"