PHP code example of gxchain / baas-sdk-php

1. Go to this page and download the library: Download gxchain/baas-sdk-php 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/ */

    

gxchain / baas-sdk-php example snippets


composer 


use GXChain\BaaS\BaaSClient;

$config = [
    'url'  => [
        'fee'   => 'https://baas-developer.gxchain.cn/api/storage/provider/',
        'store' => 'https://baas-developer.gxchain.cn/api/storage/store/',
        'get'   => 'https://baas-developer.gxchain.cn/api/storage/data/',
    ],
    'base' => [
        'from'         => '1.2.XXX',
        'to'           => '1.2.241',
        'proxyAccount' => '1.2.241',
        'percent'      => 0,
        'assetId'      => '1.3.1',
        'privateKey'   => 'XXX',
    ],

];
$obj = new BaaSClient($config);

//store
$res = $obj->store('hello gxs php ssdk v1.0.1');
echo $res;

//storeGet
// $cid = 'Qmb3eECKK9rAJbG7BpFgGxeSFDH9nkie6XugxJJUqVQUUK';
// $res = $obj->storeGet($cid);
// echo $res;