The Client class is the main entry point for all SDK operations. Create one instance per application and reuse it.
Constructor #
new Client(string $apiKey, string $baseUrl, int $timeout = 30)
| Parameter | Type | Required | Description |
|---|---|---|---|
$apiKey | string | Yes | API key (dmsi_key_*) or sandbox key (dmsi_sand_*) |
$baseUrl | string | Yes | Base URL of your WordPress site (e.g. https://yoursite.com) |
$timeout | int | No | HTTP request timeout in seconds. Default: 30 |
Resource Properties #
The Client exposes seven public readonly properties, one per resource type. Each property is an instance of the corresponding resource class.
| Property | Type | Description |
|---|---|---|
$client->customers | Customers | Customer CRUD operations |
$client->products | Products | Product CRUD operations |
$client->licenses | Licenses | License CRUD and validation |
$client->versions | Versions | Version CRUD operations |
$client->subscriptions | Subscriptions | Subscription CRUD and lifecycle |
$client->downloads | Downloads | Download management and URL generation |
$client->activations | Activations | Activation management |
Methods #
// Get the OAuth helper
$client->oauth(): OAuthHelper
// Check API health (no authentication required)
$client->health(): array
Example #
$client = new Client('dmsi_key_abc123...', 'https://yoursite.com');
// Check health
$health = $client->health();
echo $health['status']; // "ok"
// Access resources via properties
$license = $client->licenses->get(42);
$customer = $client->customers->get($license['data']['customer_id']);
