2017 © Pedro Peláez
 

library bitcoin

Lightweight PHP bitcoin client.

image

bitcont/bitcoin

Lightweight PHP bitcoin client.

  • Sunday, December 15, 2013
  • by elendir
  • Repository
  • 6 Watchers
  • 14 Stars
  • 41 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 3 % Grown

The README.md

Parsers

At the moment, two parsers are available., (*1)

blockchain.info

This parser uses blockchain.info API to retrieve information about addresses and transactions. It is easy to set up, but can be quite slow., (*2)

blockchain.info + bitcoind combined

This parser uses blockchain.info API to retrieve information about addresses and bitcoind json-rpc API to retrieve information about transactions. It is faster, but requires bitcoind., (*3)

Alternatively, you can add your own parser as long as it implements Bitcont\Bitcoin\Clients\IParser interface., (*4)

Example

// choose your parser
$bitcoin = new Bitcont\Bitcoin\Clients\BlockchainInfo\Client; // blockchain.info parser
$bitcoin = new Bitcont\Bitcoin\Clients\BitcoindInfo\Client('bitcoind username', 'bitcoind password'); // blockchain.info + bitcoind parser

// get bitcoin address
$address = $bitcoin->getAddress('1Kug5MazR3c8VsBn61JZdvzdix49K7CCES'); // returns IAddress
$address->getId(); // returns '1Kug5MazR3c8VsBn61JZdvzdix49K7CCES'

// get bitcoin transaction
$transaction = $bitcoin->getTransaction('b26369a892dcc3408afcf96af42d0313e1e3c4eed8124ba57506483b6fa3ffc6'); // returns ITransaction
$transaction->getId(); // returns 'b26369a892dcc3408afcf96af42d0313e1e3c4eed8124ba57506483b6fa3ffc6'

// get transaction inputs
$inputs = $transaction->getInputs(); // returns array of IInput

// get the first input's info
$value = $inputs[0]->getValue(); // returns the number of satoshis (integer)
$sender = $inputs[0]->getAddress(); // returns the sender address

// get transaction outputs
$outputs = $transaction->getOutputs(); // returns array of IOutput

// get the last output's value
$value = end($outputs)->getValue(); // returns the number of satoshis (integer)
$recipient = end($outputs)->getAddress(); // returns the recipient address

// get all transactions for an address
$transactions = $bitcoin->getTransactions($address); // returns array of ITransaction (oldest first)

Installation

Installation via composer recommended., (*5)

Requirements

PHP 5.3 or higher., (*6)

The Versions

15/12 2013

dev-master

9999999-dev

Lightweight PHP bitcoin client.

  Sources   Download

The Requires

 

by Michal Spicka

10/12 2013

1.0.0

1.0.0.0

Lightweight PHP bitcoin client.

  Sources   Download

The Requires

 

by Michal Spicka