PHP code example of mul53 / blzphp

1. Go to this page and download the library: Download mul53/blzphp 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/ */

    

mul53 / blzphp example snippets


blz = new Bluzelle\Client('account', 'mnemonic', 'endpoint', 'chainId', 'uuid');

use Bluzelle\Client;

api = new Client(
    'bluzelle1xhz23a58mku7ch3hx8f9hrx6he6gyujq57y3kp',
    'volcano arrest ceiling physical concert sunset absent hungry tobacco canal census era pretty car code crunch inside behind afraid express giraffe reflect stadium luxury',
    "http://localhost:1317",
    "20fc19d4-7c9d-4b5c-9578-8cedd756e0ea",
    "bluzelleTestPublic-1"
);

api->version();

api->account();

api->create('mykey', '{ a: 13 }', ['gax_fee' => '400001'], ['days' => 100]);

value = api->read('mykey');

value = api->txRead('mykey', ['max_fee' => '400001']);

api->update('mykey', '{ a: 13 }', ['max_fee': '400001'], ['days' => 100]);

api->delete('mykey', ['max_fee' => '400001']);

hasMyKey = api->has('mykey');

hasMyKey = api->txHas('mykey', ['gas_price' => 10]);

keys = api->keys();

keys = api->txKeys([ 'gas_price' => 10]);

api->rename('key', 'newkey', ['gas_price' => 10]);

number = api->count();

number = api->txCount(['gas_price' => 10]);

api->deleteAll([gas_price => 10]);

kvs = api->keyValues();

kvs = api->txKeyValues(['gas_price' => 10]);

api->multiUpdate([['key' => "key1", 'value' => "value1"], ['key' => "key2", 'value' => "value2"], ['gas_price': 10]]);

value = api->getLease('mykey');

value = api->txGetLease('mykey', ['gas_price' => 10]);

value = api->renewLease('mykey', ['max_fee' => '400001'], [ 'days' => 100 ]);

value = api->renewLeaseAll(['max_fee' => '400001'], [ 'days' => 100 ]);


keys = api->getNShortestLease(10);



keys = api.txGetNShortestLease(10, ['max_fee' => '400001']);