This package is abandoned and no longer maintained. No replacement package was suggested.

PHP implementation of the MedMij OpenPGO building blocks.

0.2.0 2018-12-19 11:09 UTC

This package is auto-updated.

Last update: 2021-06-20 15:38:14 UTC


Dear reader, The decision has been made to archive this repository. The reason is that the OpenPGO-Medmij-ImplementatieBouwstenen-PHP isn’t being used and has deferred maintenance including security vulnerabilities. If you desire to use this adapter, please contact GIDS:

Build Status


PHP implementation of the MedMij OpenPGO building blocks.

Version Guidance

This library follows Semantic Versioning. The versions of the Afspraken set are mapped to the versions of the library as follows:

Version Afsprakenset Status Version library
Afsprakenset release 1.1 Latest 0.2.*
Afsprakenset release 1.0 EOL 0.1.*


The OpenPGO PHP adapter can be installed using Composer:

$ composer require gids-open-standaarden/open-pgo-medmij-implementatie-bouwstenen-php ~0.2


The building blocks use a HTTP client (Guzzle) to connect.

For example the Whitelist client can be constructed like this:

$whitelistClient = new \MedMij\OpenPGO\Whitelist\WhitelistClient(
    new \GuzzleHttp\Client(),
    'whitelist endpoint'

Use cases

Retrieve Whitelist


The WhitelistClient can be used to retrieve the Whitelist.

$whitelist = $whitelistClient->getWhitelist();

The WhitelistService provides a convenience method isMedMijNodeWhitelisted to check if a given node is whitelisted.

$service = new \MedMij\OpenPGO\Whitelist\WhitelistService($whitelistClient);


Retrieve OCL


The OAuthClientListClient can be used to retrieve the OAuthclientlist.

$client = new \MedMij\OpenPGO\OCL\OAuthClientListClient(
    new \GuzzleHttp\Client(),
    'OAuth Client List endpoint'


The OAuthClientService provides a convenience method getOAuthClientByHostname to get an OAuthClient by its unique hostname.

$service = new \MedMij\OpenPGO\OCL\OAuthClientService($client);


Retrieve ZAL


The ZALClient can be used to retrieve the Zorgaanbiederslijst.

$client = new \MedMij\OpenPGO\ZAL\ZALClient(
    new \GuzzleHttp\Client(),
    'ZAL endpoint'


The ZorgaanbiederService provides a convenience method getZorgaanbiederByName to get a Zorgaanbieder by its unique name.

$service = new \MedMij\OpenPGO\ZAL\ZorgaanbiederService($client);


Retrieve Gegevensdienstnamenlijst

The GegevensdienstnamenlijstClient can be used to retrieve the Gegevensdienstnamenlijst.

$client = new \MedMij\OpenPGO\GNL\GegevensdienstnamenlijstClient(
    new \GuzzleHttp\Client(),
    'gegevensdienstnamenlijst endpoint'


The GegevensdienstnamenlijstService provides a convenience method getGegevensdienstById to get a Gegevensdienst by its unique identifier.

$service = new \MedMij\OpenPGO\GNL\GegevensdienstnamenlijstService($client);



This library provides the building blocks for Three Legged OAuth 2 authentication.

A PGO GW can authenticate with a ZA GW using a ZorgaanbiederProvider which is configured with

  • an OAuthclient as listed in the OAuthClientList
  • a Gegevensdienst as listed in the Zorgaanbiederslijst.
$oAuthClient = new OAuthClient('', 'De Enige Echte PGO');

$gegevensdienst = new Gegevensdienst(
    new AuthorizationEndpoint(''),
    new TokenEndpoint(''),

$zorgaanbieder = (new ZorgaanbiederProviderFactory())->create($oAuthClient, $gegevensdienst);

Step 1. Application redirects User to Service for Authorization

header('Location: ' . $provider->getAuthorizationUrl();

Note: store the state ($provider->getState()) to prevent replay attacks.

Step 2. User logs into the Service and grants Application access.

Step 3. Service redirects User back to the redirect_url.

Step 4. Application takes the code and exchanges it for an Access Token

$provider->getAccessToken('authorization_code', [
    'code' => '1234'


Clone this repository and run composer install to install the dependencies.


This library is tested using PHPUnit.

The tests can be executed with this command: