PHP code example of adrianmejias / factom-api

1. Go to this page and download the library: Download adrianmejias/factom-api 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/ */

    

adrianmejias / factom-api example snippets


'providers' => [
  ...
  
  AdrianMejias\FactomApi\FactomApiServiceProvider::class,
  
  ...

'aliases' => [
  ...
  
  'FactomApi' => AdrianMejias\FactomApi\Facades\FactomApi::class,
  'FactomWalletApi' => AdrianMejias\FactomApi\Facades\FactomWalletApi::class,
  'FactomDebugApi' => AdrianMejias\FactomApi\Facades\FactomDebugApi::class,
  
  ...



return [
  
  /**
   * Base credentials for Factom server.
   */
  'url' => env('FACTOM_URL', 'http://localhost:8088/v2'),

  'ssl' => [
    'enable' => env('FACTOM_SSL', false),
    'certificate' => env('FACTOM_CERTIFICATE', storage_path('app/factomdAPIpub.cert')),
  ],

  'username' => env('FACTOM_USERNAME'),

  'password' => env('FACTOM_PASSWORD'),

  /**
   * Factom wallet server credentials.
   */
  'wallet' => [
    'url' => env('FACTOM_WALLET_URL', 'http://localhost:8089/v2'),

    'ssl' => [
      'enable' => env('FACTOM_WALLET_SSL', false),
      'certificate' => env('FACTOM_WALLET_CERTIFICATE', storage_path('app/factomdAPIpub.cert')),
    ],

    'username' => env('FACTOM_WALLET_USERNAME'),

    'password' => env('FACTOM_WALLET_PASSWORD'),
  ],

  /**
   * Factom debug server credentials.
   */
  'debug' => [
    'url' => env('FACTOM_DEBUG_URL', 'http://localhost:8088/debug'),

    'ssl' => [
      'enable' => env('FACTOM_DEBUG_SSL', false),
      'certificate' => env('FACTOM_DEBUG_CERTIFICATE', storage_path('app/factomdAPIpub.cert')),
    ],

    'username' => env('FACTOM_DEBUG_USERNAME'),

    'password' => env('FACTOM_DEBUG_PASSWORD'),
  ],

];

Route::get('/factom/heights', function() {
  $result = FactomApi::heights();

  return response()->json($result);
});
bash
php artisan vendor:publish --provider="AdrianMejias\FactomApi\FactomApiServiceProvider"