delboy1978uk/phpbitcoin
Composer 安装命令:
composer require delboy1978uk/phpbitcoin
包简介
A PHP service for connecting to bitcoind. Also compatible with Zend Framework 2.
README 文档
README
A PHP service for connecting to bitcoind. Also compatible with Zend Framework 2
##Installation
Installation is done through composer:
composer require delboy1978uk/phpbitcoin
##Usage
use Del\Bitcoin; $config = [ 'username' => 'YOURUSERNAME', // required 'password' => 'YOURPASSWORD', // required 'host' => '127.0.0.1', // default 'port' => '8332', // default 'protocol' => 'http', // default 'ssl_certificate' => '', // default @todo ]; $btc = new Bitcoin($config); //example $info = $btc->getControlApi()->getInfo(); /* sample output { "result":{ "version":119900, "protocolversion":70002, "walletversion":60000, "balance":0.00000000, "blocks":531329, "timeoffset":0, "connections":8, "proxy":"", "difficulty":1, "testnet":false, "keypoololdest":1439840037, "keypoolsize":101, "paytxfee":0.00000000, "relayfee":0.00001000, "errors":"" }, "error":null, "id":"phpbitcoin" } */
###API's The Bitcoin object has access to each of the different API's available
$btc->getBlockchainApi(); $btc->getControlApi(); $btc->getGeneratingApi(); $btc->getMiningApi(); $btc->getNetworkApi(); $btc->getRawTransactionApi(); $btc->getUtilityApi(); $btc->getWalletApi();
Each API has docblock comments from the documentation, so you should get nice code completion. However the actual Bitcoin API docs can be found at https://bitcoin.org/en/developer-reference#rpc-quick-reference
##Usage in ZF2 Still todo ##Installing bitcoind for development puPHPet files for Vagrant included. Just vagrant up, vagrant ssh, then install Bitcoin. Unfortunately the ability to add custom repositories is not in puPHPet (yet. see puphpet/puphpet#142)
sudo apt-get install python-software-properties
sudo add-apt-repository --yes ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libboost-all-dev libdb4.8-dev libdb4.8++-dev bitcoind
cd ~
mkdir .bitcoin
cd .bitcoin
nano bitcoin.conf
Put the following info in the conf file:
server=1
daemon=1
testnet=1
rpcuser=phpbitcoin
rpcpassword=COMPLETELYrandomPASSWORD
You should use the testnet option if developing, tests connect on port 18332! Finally run bitcoind by simply typing it
bitcoind
Shut down bitcoind using the bitcoin-cli command
bitcoin-cli stop
##Donate If you like PHPBitcoin, spare half a shekel for an old ex leper. 1De1boyXJzdk4TYmHkR3st6dJmHuEaneHB
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-14