Ethereum Specifies the JSON RPC application development interface that each node needs to implement, and if you want to use PHP to develop a de-centric application (DAPP) on a ethereum blockchain, the first thing to solve is how to invoke the Ethereum JSON RPC interface using PHP:
If you want to quickly access Ethereum, for example, to support an ethereum payment, or to issue your own tokens, this
The PHP Ethereum Development Course provides the best learning path.
Although the interface specification does not contract the transport layer, most ethereum node software implements the HTTP protocol support.
So we can use PHP's HTTP development package to make the call. For example, the following code uses guzzle, the HTTP development package, to obtain the version information of the Ethereum node:
<?php$client = new GuzzleHttp\Client();$opts = [ ‘json‘ => [ ‘jsonrpc‘ => ‘2.0‘, ‘method‘ => ‘web3_clientVersion‘, ‘params‘ => [], ‘id‘ => time() ]];$rsp = $client->post(‘http://localhost:8545‘,$opts);echo $rsp->getBody() . PHP_EOL;?>
Of course you can also take advantage of some open source packaging, but in the PHP community, there is currently a lack of a unified and relatively mature ethereum development package, so in the development process of dapp, understanding the implementation of these open source code is essential, And often need to comprehensive use of various code resources to solve the problem.
Original: PHP Ethereum Development detailed
PHP calls Ethereum interface