PHP SDK
revenexx/sdk is the typed client for the revenexx API from PHP servers and apps. Like the Web SDK, you configure the endpoint, your tenant, and a credential once, then call methods on a service. This is a server-side client, so it usually uses a machine-to-machine API key.
Status: first version.
Install
The Composer package is revenexx/sdk. It requires PHP 8.1 or newer with the curl and json extensions.
composer require revenexx/sdk
Configure the client
Create a Client, set the endpoint and tenant, and add your API key.
<?php
require __DIR__ . '/vendor/autoload.php';
use RevenexxAPIRevenexx\Client;
$client = (new Client())
->setEndpoint('https://api.revenexx.com')
->setTenant('<TENANT_SLUG>')
->setApiKeyAuth('rvxk_...');
The auth methods mirror the Web SDK and set the same headers:
| Method | Header it sets | When to use it |
|---|---|---|
setApiKeyAuth($key) | X-Revenexx-Api-Key | Server-to-server. Created in the customer console. |
setBearerAuth($token) | Authorization | A user token from ID or a personal access token. Pass the value including the Bearer prefix. |
setTenant($slug) | X-Revenexx-Tenant | Always — selects which tenant the request applies to. |
The tenant slug rides on every request as the X-Revenexx-Tenant header. There's one gateway, https://api.revenexx.com — no per-region host to configure.
Make a call
Construct a service with the client, then call its methods.
<?php
use RevenexxAPIRevenexx\Services\Products;
$products = new Products($client);
$result = $products->productsList();
$product = $products->productsGet(id: '<PRODUCT_ID>');
Handle errors
Failed calls throw a RevenexxAPIRevenexxException carrying the message, an error code, and the raw response.
<?php
use RevenexxAPIRevenexx\RevenexxAPIRevenexxException;
use RevenexxAPIRevenexx\Services\Products;
$products = new Products($client);
try {
$product = $products->productsGet(id: '<PRODUCT_ID>');
} catch (RevenexxAPIRevenexxException $error) {
echo $error->getMessage();
}
What's available
The client exposes a service per API area, matching the Web SDK: Customers, Products, Orders, Carts, Payments, Shipping, Prices, Inventories, Storage, and more. The set of services and methods is generated from your tenant's API. Browse them in your editor, or read the per-tenant API at /v1/openapi.json.
Where to go next
- Web / JavaScript SDK — the same client, from JavaScript.
- Node SDK — the same client, for server-side JavaScript.
- API Explorer — browse and try every endpoint in the browser.
- Authentication — get a user token to pass to
setBearerAuth.