dmt-software / insolvency-client
Client for insolvency SOAP service
v1.0.0
2022-07-19 19:07 UTC
Requires
- php: >= 7.4
- ext-dom: *
- ext-simplexml: *
- dmt-software/command-bus-validator: ^1.0
- dmt-software/http-client-middleware: ^0.1.4
- dmt-software/jms-soap-serializer: ^2.1
Requires (Dev)
- guzzlehttp/guzzle: ^7.0
- phpunit/phpunit: ^8.5
Suggests
- guzzlehttp/guzzle: as a provider for psr-18 client and psr-17 request message factory
README
This is a client for the Dutch insolvency web service from rechtspraak.nl.
Installation
composer require dmt-software/insolvency-client
Usage
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 }