PHP code example of bdm / datafinder

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

    

bdm / datafinder example snippets


use BDM\DataFinder\Facades\DataFinder;

$result = DataFinder::business()->find('ERA Real Estate', location: 'Cape Town');

echo $result->topName();       // ERA Real Estate
echo $result->topWebsite();    // https://www.era.co.za
echo $result->topConfidence(); // 0.48
echo $result->topBand();       // weak

$result = DataFinder::business()->findSimilar('ERA Real Estate', location: 'Cape Town');

foreach ($result->results() as $competitor) {
    echo $competitor['name'] . ' — ' . $competitor['address'];
}

$result = DataFinder::business()->findProducts('KPMG South Africa', website: 'https://www.kpmg.com/za');

foreach ($result->offerings() as $offering) {
    echo $offering['name']; // Audit, Advisory, etc.
}

$result = DataFinder::validation()->business(
    name:    'ERA Real Estate',
    website: 'https://www.era.co.za',
    phone:   '+27813612603',
    address: '20 London Rd, Sea Point, Cape Town',
);

echo $result->score();    // 0.882
echo $result->verdict();  // pass
echo $result->isPassed(); // true

$job = DataFinder::bulk()->enrich([
    ['name' => 'ERA Real Estate',   'location' => 'Cape Town',     'reference' => 'lead_001'],
    ['name' => 'KPMG',              'location' => 'Johannesburg',  'reference' => 'lead_002'],
    ['name' => 'Woolworths',        'location' => 'Cape Town',     'reference' => 'lead_003'],
]);

echo $job->jobId(); // bulk_xxxxx

// Poll for results
$status = DataFinder::bulk()->status($job->jobId());
echo $status->progress() . '%'; // 100%

// Or wait for completion (small batches only)
$status = DataFinder::bulk()->enrichAndWait([
    ['name' => 'ERA Real Estate', 'location' => 'Cape Town'],
]);

foreach ($status->results() as $result) {
    echo $result['result']['name'];
}

// Domain to company profile
$result = DataFinder::business()->findByEmailDomain('[email protected]');
echo $result->name();        // ERA Group South Africa
echo $result->description(); // ERA Real Estate has been...

// Find businesses at an address
$result = DataFinder::business()->findByAddress('19 Edison Way, Century City, Cape Town');
foreach ($result->businesses() as $business) {
    echo $business['name'];
}

// VAT number lookup
$result = DataFinder::business()->findByVatNumber('4360189102', 'ZA');
echo $result->isVerified(); // true
echo $result->format();     // ZA_VAT

// Person to businesses
$result = DataFinder::business()->findByPerson('Johann Rupert', location: 'South Africa');
foreach ($result->associations() as $assoc) {
    echo $assoc['business']['name'];
}

use BDM\DataFinder\Exceptions\AuthenticationException;
use BDM\DataFinder\Exceptions\RateLimitException;
use BDM\DataFinder\Exceptions\DataFinderException;

try {
    $result = DataFinder::business()->find('ERA Real Estate', location: 'Cape Town');
} catch (AuthenticationException $e) {
    // Invalid API key
} catch (RateLimitException $e) {
    // Rate limited — retry after $e->retryAfter seconds
    sleep($e->retryAfter);
} catch (DataFinderException $e) {
    // General API error
}

use BDM\DataFinder\DataFinderClient;

$client = new DataFinderClient(
    apiKey:  'bdm_pro_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    baseUrl: 'https://api.bdmdatafinder.com/api/v1',
);

$result = $client->business()->find('ERA Real Estate', location: 'Cape Town');
bash
php artisan vendor:publish --tag=datafinder-config