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: info@gidsopenstandaarden.org.
PHP implementation of the MedMij OpenPGO building blocks.
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'
);
see https://github.com/GidsOpenStandaarden/OpenPGO/blob/master/Resources/UCI%20Opvragen%20Whitelist.pdf
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);
$service->isMedMijNodeWhitelisted('specimen-stelselnode.medmij.nl');
see https://github.com/GidsOpenStandaarden/OpenPGO/blob/master/Resources/UCI%20Opvragen%20OCL.pdf
The OAuthClientListClient
can be used to retrieve the OAuthclientlist
.
$client = new \MedMij\OpenPGO\OCL\OAuthClientListClient(
new \GuzzleHttp\Client(),
'OAuth Client List endpoint'
);
$client->getOAuthClientList();
The OAuthClientService
provides a convenience method getOAuthClientByHostname
to get an OAuthClient
by its unique hostname.
$service = new \MedMij\OpenPGO\OCL\OAuthClientService($client);
$service->getOAuthClientByHostname('medmij.deenigeechtepgo.nl');
see https://github.com/GidsOpenStandaarden/OpenPGO/blob/master/Resources/UCI%20Opvragen%20ZAL.pdf
The ZALClient
can be used to retrieve the Zorgaanbiederslijst
.
$client = new \MedMij\OpenPGO\ZAL\ZALClient(
new \GuzzleHttp\Client(),
'ZAL endpoint'
);
$client->getZAL();
The ZorgaanbiederService
provides a convenience method getZorgaanbiederByName
to get a Zorgaanbieder
by its unique name.
$service = new \MedMij\OpenPGO\ZAL\ZorgaanbiederService($client);
$service->getZorgaanbiederByName('umcharderwijk@medmij');
The GegevensdienstnamenlijstClient
can be used to retrieve the Gegevensdienstnamenlijst
.
$client = new \MedMij\OpenPGO\GNL\GegevensdienstnamenlijstClient(
new \GuzzleHttp\Client(),
'gegevensdienstnamenlijst endpoint'
);
$client->getGegevensdienstnamenlijst();
The GegevensdienstnamenlijstService
provides a convenience method getGegevensdienstById
to get a Gegevensdienst
by its unique identifier.
$service = new \MedMij\OpenPGO\GNL\GegevensdienstnamenlijstService($client);
$service->getGegevensdienstById(42);
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('medmij.deenigeechtepgo.nl', 'De Enige Echte PGO');
$gegevensdienst = new Gegevensdienst(
'4',
new AuthorizationEndpoint('https://medmij.nl/dialog/oauth'),
new TokenEndpoint('https://medmij.nl/token'),
[]
);
$zorgaanbieder = (new ZorgaanbiederProviderFactory())->create($oAuthClient, $gegevensdienst);
header('Location: ' . $provider->getAuthorizationUrl();
exit;
Note: store the state ($provider->getState()) to prevent replay attacks.
$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:
vendor/bin/phpunit