ByCloud Docs
GuidesCLIAPISDK

Authentication

Configure authentication for the PHP SDK.

Using an Access Token

If you have an access token from the ByCloud console, you can use it directly:

<?php
use ByCloud\SDK\ByCloud;
// Using an access token
$client = new ByCloud(["token" => "YOUR_ACCESS_TOKEN"]);

Using API Key Credentials

For service accounts, use the access key ID and secret access key:

<?php
use ByCloud\SDK\ByCloud;
// Using API key credentials
$client = new ByCloud([
"accessKeyId" => "YOUR_ACCESS_KEY_ID",
"secretAccessKey" => "YOUR_SECRET_ACCESS_KEY"
]);

Environment Variables

The SDK can automatically read credentials from environment variables. This is recommended for production deployments:

<?php
use ByCloud\SDK\ByCloud;
// The SDK automatically reads from environment variables:
// BYCLOUD_TOKEN or BYCLOUD_ACCESS_KEY_ID + BYCLOUD_SECRET_ACCESS_KEY
$client = new ByCloud();

Supported environment variables: BYCLOUD_TOKEN, BYCLOUD_ACCESS_KEY_ID, BYCLOUD_SECRET_ACCESS_KEY