Getting started
Install the Validakey PHP client and issue your first access token.
Install
composer require validakey/validakey-php
Load Composer’s autoloader in your application bootstrap.
Credentials
From your Validakey account and deployment you will need:
| Value | Description |
|---|---|
Base URL |
API root, e.g. https://dev.validakey.com/v1 |
Account UUID |
Your account identifier (UUIDv4). |
User app ID |
Application UUID issued for this integration. It keys the handshake — treat it as a secret. |
Subject |
Optional end-customer id for multi-tenant apps. Omit for single-tenant. |
Private key |
Bearer credential for your own account endpoints. Not needed for licences — do not ship it in distributed software. |
Configure
use Validakey\ValidakeyClient;
use Validakey\ValidakeyConfig;
$config = new ValidakeyConfig(
baseUrl: getenv('VALIDAKEY_BASE_URL'),
apiUUID: getenv('VALIDAKEY_API_UUID'),
userAppId: getenv('VALIDAKEY_USER_APP_ID'),
apiPKey: getenv('VALIDAKEY_API_PKEY'), // optional; account path only
subject: getenv('VALIDAKEY_SUBJECT') ?: null,
);
$client = new ValidakeyClient($config);
Persist the instance id
Token calls authenticate with an instance id obtained through a handshake. By default it lives in memory. For a long-lived process, persist it so concurrent requests do not invalidate each other:
use Validakey\Instance\FileInstanceStore;
$client = new ValidakeyClient(
$config,
null,
new FileInstanceStore('/var/lib/myapp/validakey-instance.json'),
);
Keep that path outside the web root.
Mint a token
use Validakey\CreateTokenRequest;
$token = $client->createToken(
new CreateTokenRequest(duration: 3600)
);
echo $token->token;
Your account needs a card on file before minting. Monthly dues start when you mint a production vKey. Priced vKeys also require the Instance Entity (end customer) to have a card on file.