Search by

masmerise / de-ridder-den-hertog-php-sdk

masmerise

An unofficial PHP SDK for accessing De Ridder & Den Hertog's API.

Package info

github.com/masmerise/de-ridder-den-hertog-php-sdk

pkg:composer/masmerise/de-ridder-den-hertog-php-sdk

Statistics

Installs: 133

Dependents: 2

Suggesters: 0

Stars: 2

Open Issues: 0

1.2.2 2026-11-22 21:24 UTC

This package is auto-updated.

Last update: 2026-11-22 21:25:10 UTC


README

RenH PHP SDK PHP

Build Status Total Downloads Latest Stable Version License

De Ridder & Den Hertog PHP SDK

This SDK provides convenient, fully-typed access to De Ridder & Den Hertog's API.

Installation

You can install the package via composer:

composer require masmerise/de-ridder-den-hertog-php-sdk

Adapters

You may also use one of the available adapters instead:

Getting started

You can always refer to the documentation to examine the various resources that are available.

Setup

use DeRidderDenHertog\Authentication\ApiGuid;
use DeRidderDenHertog\DeRidderDenHertog;

$guid = ApiGuid::fromString('{4844a45c-33d1-4937-83f4-366d36449eaf}');

$renh = DeRidderDenHertog::authenticate($guid);

Environments

The SDK targets the production environment by default. You can switch to the test environment when needed:

$renh = DeRidderDenHertog::authenticate($guid)->useTest();

Both useTest() and useProduction() are fluent and may be called at any time, affecting every subsequent request:

$renh->useTest();

$customers = $renh->getCustomers(); // https://test.renh.online

$renh->useProduction();

$customers = $renh->getCustomers(); // https://renh.online

Bear in mind that each environment requires its own API GUID.

Data retrieval

use DeRidderDenHertog\Core\Type\Parameter\Filter;

$filter = Filter::fromSql('Klantnummer=123456789');

[$customer] = $renh->getCustomers(filter: $filter);

Resource creation / update

use DeRidderDenHertog\SetCustomer\Type\Parameter\CustomerData;

$data = CustomerData::parameters(
    city: 'Ghent',
    emailAddress: 'php.sdk@github.action',
    houseNumber: '40',
    name: 'PHP SDK',
    phone: '0470123456',
    street: 'Teststraat',
    zipCode: '9000',
);

$customerId = $renh->setCustomer($data);

Failures (exception handling)

The SDK uses exceptions as its medium to communicate failures.

DeRidderDenHertogException
├── CouldNotAuthenticate (Authentication Errors)
├── CouldNotCompleteRequest (Server Faults)
├── UnknownException (Connection Errors)
└── ValidationException (Request Errors)
    ├── CouldNotDeleteCustomer
    ├── CouldNotGetApiFunctions
    ├── CouldNotGetCustomers
    ├── CouldNotGetDayTurnover
    ├── CouldNotSetCustomer
    └── ...
use DeRidderDenHertog\SetCustomer\Failure\CouldNotSetCustomer;

try {
    $customerId = $renh->setCustomer($data);
} catch (CouldNotSetCustomer $ex) {
    $logger->log($ex->getMessage());
}

Timeouts

The SDK defaults to a 30 second timeout.

The API also enforces a request budget of its own (90 seconds at the time of writing). When a request exceeds it, the API answers with a SOAP fault carrying a 200 status, which the SDK raises as a CouldNotCompleteRequest:

use DeRidderDenHertog\Core\Failure\CouldNotCompleteRequest;

try {
    $transactions = $renh->getDayTurnover(from: $from, till: $till);
} catch (CouldNotCompleteRequest $ex) {
    $logger->log($ex->fault); // "Request timeout (90 seconds). (22, ERR_TIMEOUT_REQUEST)"
}

A busy day's turnover will not fit in that budget unpaginated, so reach for getDayTurnoverPage() whenever the range is not guaranteed to be small.

Implementation progress

Action
DeleteCustomer
GetAPIFunctions
GetCustomers
GetDayTurnover
SetCustomer

While the SDK is battle-tested and production-ready, only a handful of API interactions have been implemented thus far. Please bear in mind this is an unofficial SDK, so we have to prioritize available resources at this time.

However, always feel free to submit a feature or pull request!

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security

If you discover any security related issues, please email support@masmerise.be instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.