PHP SDK (beta)

NOTE: This SDK is in Beta. We recommend using a direct API integration. If you encounter any unexpected behavior while using this SDK, please let us know.


Add the SDK from Packagist to your project. The SDK is available here.

Via Composer:

composer require silamoney/php-sdk:0.2.2

Initialize the application

require_once 'vendor/autoload.php';
use Silamoney\Client\Api\SilaApi;
use Silamoney\Client\Domain\{BalanceEnvironments,Environments};
// Load your credentials
$appHandle = 'your app handle';
$privateKey = 'your private key';
// Create your client
$client = new SilaApi('your sila endpoint url', 'your sila balance endpoint url', $appHandle, $privateKey); // From custom URL
$client = SilaApi::fromEnvironment(Environments::SANDBOX, BalanceEnvironments::SANDBOX, $appHandler, $privateKey); // From predefined environments
$client = SilaApi::fromDefault($appHandle, $privateKey); // From default sandbox environments

This sets up the app private key and handle for the SDK to use for signing subsequent requests. The other SDK functionality will not be available until this configuration is completed. The SDK does not store this information outside of the instance that is configured. Private keys are never transmitted over the network or stored outside the scope of this instance.

You can manage your apps in the Developer Console. The privateKey is the Private Key that matches the Public Key associated with the Application Handle in your Console.

Keep your Application Private Key secure! Never share it with anyone, including us. If you believe that your private key has been compromised, please replace the key for that app with a new one in the Developer Console.

Making your first API calls

The following represents a simple check_handle request:

$userHandle = 'user.silamoney.eth';
$response = $client->checkHandle($userHandle); // Returns Silamoney\Client\Api\ApiResponse