2017 © Pedro Peláez
 

library laravel-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

image

kemalevren/laravel-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  • Tuesday, March 6, 2018
  • by kemalevren
  • Repository
  • 1 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 17 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Bitcoin JSON-RPC Service Provider for Laravel

Latest Stable Version License Build Status Code Climate Dependency Status, (*1)

About

This package allows you to make JSON-RPC calls to Bitcoin Core JSON-RPC server from your laravel project. It's based on php-bitcoinrpc project - fully unit-tested Bitcoin JSON-RPC client powered by GuzzleHttp., (*2)

Installation

Run php composer.phar require denpa/laravel-bitcoinrpc in your project directory or add following lines to composer.json, (*3)

"require": {
    "denpa/laravel-bitcoinrpc": "^1.1"
}

and run php composer.phar update., (*4)

Add Denpa\Bitcoin\Providers\ServiceProvider::class, line to the providers list somewhere near the bottom of your /config/app.php file., (*5)

'providers' => [
    ...
    Denpa\Bitcoin\Providers\ServiceProvider::class,
];

Publish config file by running php artisan vendor:publish --provider="Denpa\Bitcoin\ServiceProvider" in your project directory., (*6)

You might also want to add facade to $aliases array in /config/app.php., (*7)

'aliases' => [
    ...
    'Bitcoind' => Denpa\Bitcoin\Facades\Bitcoind::class,
];

I recommend you to use .env file to configure client. To connect to Bitcoin Core you'll need to add at least following parameters, (*8)

BITCOIND_USER=(rpcuser from bitcoin.conf)
BITCOIND_PASSWORD=(rpcpassword from bitcoin.conf)

Requirements

  • PHP 7.0 or higher (should also work on 5.6, but this is unsupported)
  • Laravel 5.1 or higher

Usage

You can perform request to Bitcoin Core using any of methods listed below:, (*9)

Helper Function

<?php

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());
   }
}

Facade

<?php

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());
   }
}

Automatic Injection

<?php

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());
   }
}

License

This product is distributed under MIT license., (*10)

Donations

If you like this project, you can donate Bitcoins to 13gkVWc3sdzpmCLkGkXXfPBwnh6ZXct947., (*11)

Thanks for your support!❤, (*12)

The Versions

06/03 2018

dev-master

9999999-dev https://github.com/denpamusic/laravel-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Denis Paavilainen

laravel api guzzle bitcoin jsonrpc

06/03 2018

dev-kemalevren-patch-1

dev-kemalevren-patch-1 https://github.com/denpamusic/laravel-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Denis Paavilainen

laravel api guzzle bitcoin jsonrpc

06/03 2018

v1.1.2

1.1.2.0 https://github.com/denpamusic/laravel-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Denis Paavilainen

laravel api guzzle bitcoin jsonrpc

17/08 2017

v1.1.1

1.1.1.0 https://github.com/denpamusic/laravel-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Denis Paavilainen

laravel api guzzle bitcoin jsonrpc

02/05 2017

v1.1.0

1.1.0.0 https://github.com/denpamusic/php-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Denis Paavilainen

laravel api guzzle bitcoin jsonrpc

01/02 2017

v1.0.1

1.0.1.0 https://github.com/denpamusic/php-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Denis Paavilainen

laravel api guzzle bitcoin jsonrpc

01/02 2017

v1.0.0

1.0.0.0 https://github.com/denpamusic/php-bitcoinrpc

Bitcoin JSON-RPC Service Provider for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Denis Paavilainen

laravel api guzzle bitcoin jsonrpc