PHP code example of kemalevren / laravel-bitcoinrpc
1. Go to this page and download the library: Download kemalevren/laravel-bitcoinrpc 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/ */
kemalevren / laravel-bitcoinrpc example snippets composer.phar
composer.phar update
'providers' => [
...
Denpa\Bitcoin\Providers\ServiceProvider::class,
];
'aliases' => [
...
'Bitcoind' => Denpa\Bitcoin\Facades\Bitcoind::class,
];
namespace App\Http\Controllers;
class BitcoinController extends Controller
{
/**
* Get block info.
*
* @return object
*/
public function blockInfo()
{
$blockHash = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f';
$blockInfo = bitcoind()->getBlock($blockHash);
return response()->json($blockInfo->get());
}
}
namespace App\Http\Controllers;
use Bitcoind;
class BitcoinController extends Controller
{
/**
* Get block info.
*
* @return object
*/
public function blockInfo()
{
$blockHash = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f';
$blockInfo = Bitcoind::getBlock($blockHash);
return response()->json($blockInfo->get());
}
}
namespace App\Http\Controllers;
use Denpa\Bitcoin\Client as BitcoinClient;
class BitcoinController extends Controller
{
/**
* Get block info.
*
* @param BitcoinClient $bitcoind
* @return \Illuminate\Http\JsonResponse
*/
public function blockInfo(BitcoinClient $bitcoind)
{
$blockHash = '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f';
$blockInfo = $bitcoind->getBlock($blockHash);
return response()->json($blockInfo->get());
}
}