PHPackages                             oprokidnev/bitcoind-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. oprokidnev/bitcoind-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

oprokidnev/bitcoind-php
=======================

PHP Wrapper for a bitcoind daemon

2.0.2(11y ago)010MITPHPPHP &gt;=5.4

Since Aug 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/oprokidnev/bitcoind-php)[ Packagist](https://packagist.org/packages/oprokidnev/bitcoind-php)[ Docs](https://github.com/nbobtc/bitcoind-php)[ RSS](/packages/oprokidnev-bitcoind-php/feed)WikiDiscussions 2.x Synced today

READMEChangelogDependencies (5)Versions (10)Used By (0)

nbobtc/bitcoind-php [![Travis branch](https://camo.githubusercontent.com/b53f546502d7abdf77462d59779c2205f8c3545c3dd64f4f88b565a36a6fa1b0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6e626f6274632f626974636f696e642d7068702f322e782e737667)](https://travis-ci.org/nbobtc/bitcoind-php) [![Packagist](https://camo.githubusercontent.com/2a99a9a424df1b2c3bc52b9a32326c02b306fa60ebfcc3fad28733d5127840fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e626f6274632f626974636f696e642d7068702e737667)](https://packagist.org/packages/nbobtc/bitcoind-php) [![Packagist Pre Release](https://camo.githubusercontent.com/bbf377806730c19ffd209c4f4c0edba1e2f68cb435cc28b33221eb49e6770a5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f6e626f6274632f626974636f696e642d7068702e737667)](https://packagist.org/packages/nbobtc/bitcoind-php)
=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#nbobtcbitcoind-php---)

[![Code Climate](https://camo.githubusercontent.com/be177c655e20b6147bc289ac78404e7a3132307211be801ad1812f462cc42874/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f6769746875622f6e626f6274632f626974636f696e642d7068702e737667)](https://codeclimate.com/github/nbobtc/bitcoind-php) [![Code Climate](https://camo.githubusercontent.com/d56269b93ae359c431183c77d6465b7b6d4daec02a60d6aa62103e8488cca4cb/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636c696d6174652f636f7665726167652f6769746875622f6e626f6274632f626974636f696e642d7068702e737667)](https://codeclimate.com/github/nbobtc/bitcoind-php) [![SensioLabs Insight](https://camo.githubusercontent.com/3cb2a8e759fefeaf7ee31c0d3dce5ad0bec8967ac78f5fb1a5557b553d77172c/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f63376166393138322d663533622d343136342d383230642d3436653734393932353266332e737667)](https://insight.sensiolabs.com/projects/c7af9182-f53b-4164-820d-46e7499252f3)

This project is used to interact with a headless bitcoin program called bitcoind. It also contains various utility classes for working with Bitcoin as a PHP Developer.

Installation
------------

[](#installation)

You can install this library by using [Composer](https://getcomposer.org/). You can also view more info about this on [Packagist](https://packagist.org/packages/nbobtc/bitcoind-php).

Add this to the `require` section in your `composer.json` file.

```
{
    "require": {
        "nbobtc/bitcoind-php": "~2.0"
    }
}
```

Usage
-----

[](#usage)

To use the project you need to just create a new instance of the class.

```
$command = new \Nbobtc\Command\Command('getinfo');
$client  = new \Nbobtc\Http\Client('https://username:password@localhost:18332');

/** @var \Nbobtc\Http\Message\Response */
$response = $client->sendCommand($command);

/** @var string */
$contents = $response->getBody()->getContents();
```

You are able to get the [Request](https://github.com/nbobtc/bitcoind-php/blob/2.x/src/Http/Message/Request.php) and [Response](https://github.com/nbobtc/bitcoind-php/blob/2.x/src/Http/Message/Response.php) objects back from the client with the correct getters: `getRequest()` and `getResponse()`.

You can also parse the response however you wish to do so since the result is returned to you as a string. See below for some ideas!

Commands
--------

[](#commands)

Commands are created in such a way that this will support any future updates the [Bitcoin API](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list) by providing you with an easy class that sets all the required information.

You are able to pass into the object the `method` and the `parameters` that are required. Here are a few examples:

```
// No Parameters
$command = new Command('getinfo');

// One Parameter
$command = new Command('getblock', '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f');

// Multiple Parameters
$command = new Command('sendfrom', array('fromaccount', 'tobitcoinaddress', 'amount'));
```

The second argument MUST be in the same order as on the [Bitcoin API](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list) wiki page. There is no need to assign the values any keys.

### Parameters

[](#parameters)

Parameters are the second argument when creating a new Command. This argument can either be a string OR an array. For example, both of these are valid.

```
$command = new Command('getblock', array('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f'));
$command = new Command('getblock', '000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f');
```

Most commands in the [Bitcoin API](https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list) take one parameter. If it takes MORE than one, you must pass the parameters in as an array in the ORDER you find them on that page.

### Extending Commands

[](#extending-commands)

If, for any reason, you need to extend a command, it MUST implement [CommandInterface](https://github.com/nbobtc/bitcoind-php/blob/2.x/src/Command/CommandInterface.php). You can find documentation within the interface on how to implement this.

Drivers
-------

[](#drivers)

Drivers are used by the ClientInterface for connecting to a bitcoind service and sending Requests. The return a Response. If you need to implement a new driver take a look at the [DriverInterface](https://github.com/nbobtc/bitcoind-php/blob/2.x/src/Http/Driver/DriverInterface.php).

### cURL Driver

[](#curl-driver)

This is used by default and allows you a lot of options for customizing it to your needs.

You can set various [cURL Options](http://php.net/manual/en/function.curl-setopt.php) by passing them into the function `addCurlOption($option, $value)`.

Here's an example of how to configure and use the driver.

```
$driver = new \Nbobtc\Http\Driver\CurlDriver();
$driver
    ->addCurlOption(CURLOPT_VERBOSE, true)
    ->addCurlOption(CURLOPT_STDERR, '/var/logs/curl.err');

$client = new \Nbobtc\Http\Client('https://username:password@localhost:18332');
$client->withDriver($driver);
```

Feel free to take a look at the `CurlDriver` source code.

Cookbook
--------

[](#cookbook)

### How to enable a Keep-Alive ie Persistent Connection

[](#how-to-enable-a-keep-alive-ie-persistent-connection)

This example shows how you are able to set the client up to [Persistent Connection](http://en.wikipedia.org/wiki/HTTP_persistent_connection).

```
$client = new \Nbobtc\Http\Client('https://username:password@localhost:18332');
$client->getRequest()->withHeader('Connection', 'Keep-Alive');
```

### How to set a CA Cert

[](#how-to-set-a-ca-cert)

This library provides some wonderful flexibility that will allow you to configure the client to use your own CA Cert.

```
$driver = new \Nbobtc\Http\Driver\CurlDriver();
$driver->addCurlOption(CURLOPT_CAINFO, '/path/to/cert');

$client = new \Nbobtc\Http\Client('https://username:password@localhost:18332');
$client->withDriver($driver);
```

### How to Convert Output to an Array

[](#how-to-convert-output-to-an-array)

Some like the arrays

```
$response = $client->sendCommand($command);
$output   = json_decode($response->getBody()->getContents(), true);
```

### How to Convert Output to a stdClass object

[](#how-to-convert-output-to-a-stdclass-object)

Some like the objects

```
$response = $client->sendCommand($command);
$output   = json_decode($response->getBody()->getContents());
```

Testing
-------

[](#testing)

All testing is done using PHPUnit. You should be able to run `phpunit` in the root directory of this project (the directory where phpunit.xml.dist is located) and the tests will run.

If submitting a pull request or working on this library, please make sure that the tests will pass.

Change log
----------

[](#change-log)

See [CHANGELOG.md](https://github.com/nbobtc/bitcoind-php/blob/2.x/CHANGELOG.md).

Contains information on releases such as what was added, changed, etc. It's good to look at to see what has changed from release to release.

Contributing
------------

[](#contributing)

See [CONTRIBUTING.md](https://github.com/nbobtc/bitcoind-php/blob/2.x/CONTRIBUTING.md).

Various ways on contributing to this project.

Branching
---------

[](#branching)

### master

[](#master)

This is the latest and greatest, it should not be used an is considered development for testing new features and functionality. This should NOT be used in a production environment.

### 2.x

[](#2x)

Current production branch. All 2.x tags come off of this branch.

### 1.x

[](#1x)

Deprecated, only used for bug fixes and for historical records.

Releasing
---------

[](#releasing)

You can find a complete list of [Releases](https://github.com/nbobtc/bitcoind-php/releases) on GitHub.

### Checklist

[](#checklist)

- Update `composer.json` with new minor or patch increase.
- Update `README.md` with installation instructions for new release.
- Update [CHANGELOG.md](https://github.com/nbobtc/bitcoind-php/blob/2.x/CHANGELOG.md) with release info and get rid of unreleased section.
- Make tag and push tag up.
- Copy section in [CHANGELOG.md](https://github.com/nbobtc/bitcoind-php/blob/2.x/CHANGELOG.md) that pertains to the release and add info to release docs on GitHub.
- Update [CHANGELOG.md](https://github.com/nbobtc/bitcoind-php/blob/2.x/CHANGELOG.md) with unreleased section

License (MIT) [![Packagist](https://camo.githubusercontent.com/c80db178e6cf5bc421f6ee87cf2fc61ca4b6d819a91a010dc01fe58432a6c2e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e626f6274632f626974636f696e642d7068702e737667)](https://github.com/nbobtc/bitcoind-php/blob/2.x/LICENSE)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#license-mit-)

Copyright (C) 2012-2014 Joshua Estes

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 82.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~116 days

Recently: every ~148 days

Total

8

Last Release

3525d ago

Major Versions

1.2.0 → 2.0.02015-03-22

1.x-dev → 2.x-dev2016-11-03

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

1.2.0PHP &gt;=5.4.0

2.0.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/75efd2f692107c6f5e9e477ecd1df0334dd44921f58c1c35ccc6211c977176df?d=identicon)[oprokidnev](/maintainers/oprokidnev)

---

Top Contributors

[![JoshuaEstes](https://avatars.githubusercontent.com/u/447419?v=4)](https://github.com/JoshuaEstes "JoshuaEstes (130 commits)")[![Ocramius](https://avatars.githubusercontent.com/u/154256?v=4)](https://github.com/Ocramius "Ocramius (11 commits)")[![sanasol](https://avatars.githubusercontent.com/u/1709666?v=4)](https://github.com/sanasol "sanasol (4 commits)")[![deweller](https://avatars.githubusercontent.com/u/51414?v=4)](https://github.com/deweller "deweller (3 commits)")[![skrajewski](https://avatars.githubusercontent.com/u/4791560?v=4)](https://github.com/skrajewski "skrajewski (2 commits)")[![analogic](https://avatars.githubusercontent.com/u/934254?v=4)](https://github.com/analogic "analogic (2 commits)")[![willgriffin](https://avatars.githubusercontent.com/u/590602?v=4)](https://github.com/willgriffin "willgriffin (1 commits)")[![dexX7](https://avatars.githubusercontent.com/u/5836089?v=4)](https://github.com/dexX7 "dexX7 (1 commits)")[![greatwitenorth](https://avatars.githubusercontent.com/u/547583?v=4)](https://github.com/greatwitenorth "greatwitenorth (1 commits)")[![neilgarb](https://avatars.githubusercontent.com/u/598376?v=4)](https://github.com/neilgarb "neilgarb (1 commits)")[![scr34m](https://avatars.githubusercontent.com/u/259758?v=4)](https://github.com/scr34m "scr34m (1 commits)")

---

Tags

bitcoinbitcoindbitcoins

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/oprokidnev-bitcoind-php/health.svg)

```
[![Health](https://phpackages.com/badges/oprokidnev-bitcoind-php/health.svg)](https://phpackages.com/packages/oprokidnev-bitcoind-php)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k86.9M2.2k](/packages/symfony-symfony)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[algolia/algoliasearch-client-php

API powering the features of Algolia.

69734.4M144](/packages/algolia-algoliasearch-client-php)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

318117.1k1](/packages/cognesy-instructor-php)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M521](/packages/shopware-core)[typo3/cms-redirects

TYPO3 CMS Redirects - Create manual redirects, list existing redirects and automatically createredirects on slug changes.

167.3M74](/packages/typo3-cms-redirects)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
