PHP code example of nimiq-community / php-client

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

    

nimiq-community / php-client example snippets


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

$client = new \NimiqCommunity\RpcClient\NimiqClient($config);

$client = new \NimiqCommunity\RpcClient\NimiqClient();

// make rpc call to get the block number
$blockNumber = $client->getBlockNumber();

echo $blockNumber; // displays the block number, for example 748883


sh
# Install Composer
curl -sS https://getcomposer.org/installer | php
sh
php composer.phar 
sh
php composer.phar install
sh
php composer.phar run-script test
sh
php composer.phar run-script coverage
sh
php composer.phar run-script docs