PHP code example of monkeytips / monkeytips-walletd-rpc-php

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

    

monkeytips / monkeytips-walletd-rpc-php example snippets


use monkeytips\Walletd;

$walletd = new Walletd\Client();

$response = $walletd->getBalance($walletAddress);

use monkeytips\Walletd;

$config = [
    'rpcHost'     => 'http://127.0.0.1',
    'rpcPort'     => 8070,
    'rpcPassword' => 'test',
];

$walletd = new Walletd\Client($config);

$json = $walletd->getBalance($walletAddress)->getBody()->getContents();

echo $json;

> {"id":0,"jsonrpc":"2.0","result":["availableBalance":100,"lockedAmount":50]}

composer