PHP code example of majestic / laravel-litecoinrpc

1. Go to this page and download the library: Download majestic/laravel-litecoinrpc 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/ */

    

majestic / laravel-litecoinrpc example snippets

 composer.phar 
 composer.phar update

'providers' => [
    ...
    Majestic\Litecoin\Providers\ServiceProvider::class,
];

'aliases' => [
    ...
    'Litecoind' => Majestic\Litecoin\Facades\Litecoind::class,
];



namespace App\Http\Controllers;

class LitecoinController extends Controller
{
  /**
   * Get block info.
   *
   * @return object
   */
   public function blockInfo()
   {
      $blockHash = '9d4d9fd2f4dee46d5918861b7bbff81f52c581c3b935ad186fe4c5b6dc58d2f8';
      $blockInfo = litecoind()->getBlock($blockHash);
      return response()->json($blockInfo->get());
   }
}



namespace App\Http\Controllers;

use Litecoind;

class LitecoinController extends Controller
{
  /**
   * Get block info.
   *
   * @return object
   */
   public function blockInfo()
   {
      $blockHash = '9d4d9fd2f4dee46d5918861b7bbff81f52c581c3b935ad186fe4c5b6dc58d2f8';
      $blockInfo = Litecoind::getBlock($blockHash);
      return response()->json($blockInfo->get());
   }
}



namespace App\Http\Controllers;

use Majestic\Litecoin\Client as LitecoinClient;

class LitecoinController extends Controller
{
  /**
   * Get block info.
   *
   * @param  LitecoinClient  $litecoind
   * @return \Illuminate\Http\JsonResponse
   */
   public function blockInfo(LitecoinClient $litecoind)
   {
      $blockHash = '9d4d9fd2f4dee46d5918861b7bbff81f52c581c3b935ad186fe4c5b6dc58d2f8';
      $blockInfo = $litecoind->getBlock($blockHash);
      return response()->json($blockInfo->get());
   }
}