PHP code example of yoruchiaki / php-webase-front

1. Go to this page and download the library: Download yoruchiaki/php-webase-front 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/ */

    

yoruchiaki / php-webase-front example snippets



use  Yoruchiaki\WebaseFront\HttpClient\AppConfig;
use  Yoruchiaki\WebaseFront\HttpClient\HttpRequest;

$httpClient = new HttpRequest(
      new AppConfig(
                "http://10.0.200.118:5002/WeBASE-Front/",
                5
      )
);

$abiClient = new \Yoruchiaki\WebaseFront\Services\Contract\ContractService($httpClient);
//Contract,Bin,Sol都可以使用相同的方法进行初始化.
$abi = new \Yoruchiaki\WebaseFront\ValueObjects\SolidityAbi();
$abi->loadPath('/filePath/demo.abi');// 载入abi文件路径也可以在构造函数中传入文件内容进行初始化
$bin = new \Yoruchiaki\WebaseFront\ValueObjects\SolidityBin();
$bin->loadPath('/filePath/demo.bin');// 载入abi文件路径也可以在构造函数中传入文件内容进行初始化
$sol = new \Yoruchiaki\WebaseFront\ValueObjects\SoliditySol(
    file_get_contents('/filePath/demo.sol')
);

$solidity = new \Yoruchiaki\WebaseFront\ValueObjects\Solidity(
    'demo',
    $abi,
    $bin,
    $sol
);
$contractAddress = '0xabcd....';
$abiClient->abiInfo($solidity,$contractAddress);
$abiClient->addContractPath('path-folder');
$abiClient->compileJava($solidity);
$abiClient->contractCompile('demo',$sol);
$abiClient->contractList(1,10);
...

use Yoruchiaki\WebaseFront\Facade\ContractFacade;

ContractFacade::abiInfo($solidity,$contractAddress);
...

当前版本还有如下方法可以调用
use Yoruchiaki\WebaseFront\Facade\ContractFacade; //合约
use Yoruchiaki\WebaseFront\Facade\ToolFacade; //工具
use Yoruchiaki\WebaseFront\Facade\PrivateKeyFacade; //密钥
use Yoruchiaki\WebaseFront\Facade\TransFacade; //交易
shell
$ composer 

php artisan vendor:publish --tag="webase-front"