PHP code example of xiaoye0402 / slash-php-sdk
1. Go to this page and download the library: Download xiaoye0402/slash-php-sdk library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xiaoye0402 / slash-php-sdk example snippets
lashPhpSdk\SlashPhpSdk;
// 创建SDK实例
$sdk = new SlashPhpSdk([
'api_key' => 'your-api-key-here',
'base_url' => 'https://api.joinslash.com'
]);
//必须在协程中运行
\Swoole\Coroutine\run(function () use ($sdk) {
// 获取账户列表
$accounts = $sdk->account()->list();
print_r($accounts);
// 创建新账户
$newAccount = $sdk->account()->create([
'name' => 'Example Account',
'type' => 'checking',
'balance' => 1000.00
]);
print_r($newAccount);
});
bash
composer