PHP code example of lunanimous / php-rpc-client

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

    

lunanimous / php-rpc-client example snippets




$config = [
    'scheme' => 'http',
    'host' => '127.0.0.1',
    'port' => 8648,
    'user' => 'luna',
    'password' => 'moon',
    'timeout' => false,
];

$client = new \Lunanimous\Rpc\NimiqClient($config);

$client = new \Lunanimous\Rpc\NimiqClient();
$blockNumber = $client->getBlockNumber();

echo $blockNumber;
sh
# Install Composer
curl -sS https://getcomposer.org/installer | php
sh
php composer.phar 
json
{
    "unanimous/php-rpc-client": "~1.0"
    }
}