PHP SDK (ECDSA only)
SDK's and Authentication
Authentication Token and SDK's
Given that utilizing the Authentication Token is less complex than the ECDSA Authentication we have NOT provided SDK support for the Authentication Token and we do not intend to add support to SDKs for auth token.Migrating from ECDSA to Authentication Token
Customers with apps using ECDSA will eventually be required to migrate their existing apps in the near future. Deprecating the ECDSA (legacy) Authentication Scheme is on the roadmap, but does not yet have an ETA.Sila will send out communication via the news letter and update the docs when this migration needs to take place.
The PHP SDK requires PHP 7.2 and above.
PHP extensions required
- ext-curl
- ext-json
- ext-mbstring
- ext-gmp (not usually enabled by default)
- ext-openssl
Initialization 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.
Installation
// Installation
Via Composer
composer require silamoney/php-sdk:1.0.1
// Initialization
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
transferfrom 4837449727_to 269217951921-5000$
// From predefined environments
$client = SilaApi::fromEnvironment(Environments::SANDBOX(), BalanceEnvironments::SANDBOX(), $appHandle, $privateKey);
// From custom URL
$client = new SilaApi('your sila endpoint url', 'your sila balance endpoint url', $appHandle, $privateKey);
// From default sandbox environments
$client = SilaApi::fromDefault($appHandle, $privateKey);
Wallet Generation
The installation step does not require ==wallet generation== the Wallet Generation code provided here are the wallet environment variables that you will need when you get to the register step. They will live with the other environment variable but you do not need them in the initial installation set up.
// Generate wallet
$wallet = $client->generateWallet();
echo $wallet->getPrivateKey(); // Wallet private key
Updated 2 months ago