PHP code example of gegosoft / laravel-ethereum

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

    

gegosoft / laravel-ethereum example snippets


'providers' => [
    // Other service providers...

    Gegosoft\LaravelEthereum\EthereumServiceProvider::class,
],

use Gegosoft\LaravelEthereum\Facade\Ethereum;

'aliases' => [
    ...
    'Ethereum' => Gegosoft\LaravelEthereum\Facade\Ethereum::class,
],

$app->register(Gegosoft\LaravelEthereum\EthereumServiceProvider::class);

try{
        $ret = \Gegosoft\LaravelEthereum\Facade\Ethereum::eth_protocolVersion();
        print_r($ret);
    }catch (Exception $e){
        echo $e->getMessage();
    }

try{
        $ret = \Gegosoft\LaravelEthereum\Facade\Ethereum::eth_protocolVersion();
        print_r($ret);
    }catch (Exception $e){
        echo $e->getMessage();
    }

$thereum = app('Ethereum');

$result=$thereum->eth_protocolVersion();
bash
mkdir config
cp vendor/gegosoft/laravel-ethereum/config/ethereum.php config/ethereum.php
bash
php artisan vendor:publish