7

Is there any way to communicate with ethereum through php ? what i want is to get Smart contract details from contract address like Contract token name, decimal, abi, balance, tokens supply symbols etc. till now what i know is web3.js is a official library to interact with ethereum but there is no implementation in php. I have limitation i cant use js, only option that i have is php. Let me know if there is any web3.js implementation or any other way to interact with smart contract through php.

1

web3.js doesn't communicate with the Ethereum network directly. Instead, web3.js connects to an Ethereum node running on the user's computer such as Parity, MetaMask, Mist or just geth. This node in turn communicates with the Ethereum network.

You cannot use web3.js with PHP, because it is written in and for JavaScript only. There is no official implementation of web3 in PHP.

You will have to use PHP to communicate with a local Ethereum node. I recommend doing this through its JSON RPC interface. You can find the documentation here:

https://github.com/ethereum/wiki/wiki/JSON-RPC

There's a small library for easily doing this in PHP here, although it is two years old:

https://github.com/btelle/ethereum-php

0

There is currently

https://github.com/digitaldonkey/ethereum-php

and more recently

https://github.com/web3p/web3.php

-1

As @Jesse Busman said, not PHP library to use web3 API. Also, using JSON-RPC only will limit your app and make it more complicate for you to code what you really want, which is mostly token interaction. Lot of things you can do with web3 that you cant through JSONRPC!

web3.js is what you look for, and I don't recommend PHP for building ETH Dapp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.