This is a client for the Dutch insolvency web service from rechtspraak.nl.
composer require dmt-software/insolvency-client
Before using this server please visit rechtspraak.nl and read the technical documentation (Dutch)
use DMT\Insolvency\Client;
use DMT\Insolvency\Config;
use DMT\Insolvency\Exception\Exception;
use DMT\Insolvency\Exception\RequestException;
use DMT\CommandBus\Validator\ValidationException;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
$client = new Client(
new Config([
'user' => '{{ username }}',
'password' => '{{ password }}'
]),
/** @var ClientInterface $httpClient */
$httpClient,
/** @var RequestFactoryInterface $requestFactory */
$requestFactory,
);
try {
$publicatieLijst = $client->searchUndertaking(
'{{ company name }}',
'{{ kvk-number }}' // chamber of commerce number
);
foreach ($publicatieLijst->publicaties as $publicatie) {
if (!in_array($publicatie->publicatieKenmerk, (array)$cachedPublications)) {
$insolvente = $publicatie->insolvente; // lazy loads insolvency
}
}
} catch (RequestException $exception) {
// user input errors
$message = $exception->getMessage();
if ($exception->getPrevious() instanceof ValidationException) {
$message = (string) $exception->getPrevious()->getViolations();
}
echo $message;
} catch (Exception $exception) {
// server error
}