PHP code example of mantix / kvk-api

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

    

mantix / kvk-api example snippets


use Mantix\KvkApi\ClientFactory;

$apiKey = '<YOUR_KVK_API_KEY>';
$kvk = ClientFactory::create($apiKey);

// Search by company name
$companies = $kvk->search('Mantix');

// Search with pagination
$kvk->setPage(1)
    ->setResultsPerPage(10);
$companies = $kvk->search('Mantix');

// By KvK number
$companies = $kvk->searchByKvkNumber('12345678');

// By RSIN
$companies = $kvk->searchByRsin('123456789');

// By establishment number
$companies = $kvk->searchByVestigingsnummer('000012345678');

// Fetch detailed company profile
$profile = $kvk->getBaseProfile('12345678');

// Search with additional parameters
$companies = $kvk->search('Mantix', [
    'pagina' => 1,
    'resultatenPerPagina' => 10,
    // Add any other API parameters
]);

// Using SSL certificate
$rootCertificate = '<PATH_TO_SSL_CERT>';
$kvk = ClientFactory::create($apiKey, $rootCertificate);

use Mantix\KvkApi\Exceptions\KvkApiException;

try {
    $companies = $kvk->search('Mantix');
} catch (KvkApiException $e) {
    // Handle API-specific errors
    echo $e->getMessage();
} catch (\Exception $e) {
    // Handle general errors
    echo $e->getMessage();
}