inserve / dsd-contract-management-api-php
A PHP client for the DSD Contract Management API
Package info
github.com/inserveit/dsd-contract-management-api-php
pkg:composer/inserve/dsd-contract-management-api-php
Requires
- php: ^8.4
- guzzlehttp/guzzle: ^7.7
- guzzlehttp/psr7: ^2.6
- phpdocumentor/reflection-docblock: ^5.3
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/log: ^3.0
- symfony/property-access: ^6.4 || ^7.0 || ^8.0
- symfony/property-info: ^6.4 || ^7.0 || ^8.0
- symfony/serializer: ^6.4 || ^7.0 || ^8.0
Requires (Dev)
- illuminate/config: ^11.0 || ^12.0 || ^13.0
- illuminate/container: ^11.0 || ^12.0 || ^13.0
- illuminate/support: ^11.0 || ^12.0 || ^13.0
- phpstan/phpstan: ^2.3
- phpunit/phpunit: ^13
- squizlabs/php_codesniffer: ^4.0
- vimeo/psalm: ^6.20
- vlucas/phpdotenv: ^5.6
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A PHP 8.4+ wrapper for the DSD Contract Management API v1. Also supports listing and retrieving clients from the DSD End Client API v1.
| Method | Endpoint | Client method |
|---|---|---|
| GET | /v1/contracts |
$api->contracts()->list() |
| GET | /v1/contracts/{id} |
$api->contracts()->get($id) |
| GET | /v1/products |
$api->products()->list() |
| GET | /v1/products/{sku} |
$api->products()->get($sku) |
| GET | /v1/end-clients |
$api->endClients()->list() |
| GET | /v1/end-clients/{clientId} |
$api->endClients()->get($clientId) |
The documentation specifies bearer authentication and does not document a token issuance or refresh endpoint. Obtain your token from DSD.
Installation
composer require inserve/dsd-contract-management-api-php`
Inject the client into a controller, service, or job:
use Inserve\DSDContractManagementAPI\DSDContractManagementAPIClient; use Inserve\DSDContractManagementAPI\Options\ContractFilters; $token = 'access.token'; $api = DSDContractManagementAPIClient::create(accessToken: $token); var_dump($api->contracts()->list(offset: 0, limit: 1));
End-client requests use https://end-client-api.dsdeurope.com and share the access token with contracts and products, including updates through setAccessToken(). The existing baseUri option still applies to contracts and products; use endClientBaseUri in create() or the injected APIClient to override the end-client origin.
use Inserve\DSDContractManagementAPI\Options\EndClientFilters; $page = $api->endClients()->list( offset: 0, limit: 20, filters: new EndClientFilters(active: true, company: 'Example BV'), ); $client = $api->endClients()->get(7); foreach ($api->endClients()->all(new EndClientFilters(country: 'NL')) as $client) { echo $client->getName(); }
EndClientFilters supports active, name, firstName, lastName, company, postalCode, city, country, phone, email, numberCoc, and numberVat. List responses expose getResult() and getPagination(); all() fetches pages lazily.
Development
composer install
composer test