PHPackages                             andkom/php-bitcoin-blockchain - 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. [Database &amp; ORM](/categories/database)
4. /
5. andkom/php-bitcoin-blockchain

ActiveLibrary[Database &amp; ORM](/categories/database)

andkom/php-bitcoin-blockchain
=============================

A simple PHP library for reading Bitcoin blockchain database.

1.0.0(7y ago)151114[1 issues](https://github.com/andkom/php-bitcoin-blockchain/issues)MITPHPPHP ^7.1

Since Dec 15Pushed 6y ago2 watchersCompare

[ Source](https://github.com/andkom/php-bitcoin-blockchain)[ Packagist](https://packagist.org/packages/andkom/php-bitcoin-blockchain)[ RSS](/packages/andkom-php-bitcoin-blockchain/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

PHP Bitcoin Blockchain Parser
-----------------------------

[](#php-bitcoin-blockchain-parser)

A PHP implementation of Bitcoin blockchain database parser.

### Features:

[](#features)

- Parse unordered block data
- Parse ordered block data
- Parse block index
- Parse chain state (UTXO database)

### Requirements

[](#requirements)

- PHP &gt;= 7.1
- Bitcoin Core &gt;= 0.15.1
- leveldb &gt;= 1.20
- php-leveldb &gt;= 0.2.1
- php-gmp &gt;= 7.1

### Installation

[](#installation)

```
composer require andkom/php-bitcoin-blockchain

```

### Examples

[](#examples)

```
$databaseReader = new DatabaseReader('/path/to/bitcoin');

// read ordered blocks
foreach ($databaseReader->readBlocks() as $block) {
}

// read unordered blocks
foreach ($databaseReader->readBlocksUnordered() as $block) {
}

// read UTXO
foreach ($databaseReader->getChainstate()->read() as $utxo) {
}

// get block by hash
$block = $databaseReader->getBlockByHash('binary hash in little endian');

// get block by height
$block = $databaseReader->getBlockByHeight(12345);

// get best block hash
$hash = $databaseReader->getChainstate()->getBestBlock();
```

See more examples in the examples dir.

### LevelDB installation

[](#leveldb-installation)

Ubuntu/Debian:

```
apt-get install libleveldb-dev
pecl install leveldb-0.2.1
```

Mac OS:

```
brew install leveldb
pecl install leveldb-0.2.1
```

Or compile from source:

```
git clone https://github.com/google/leveldb.git
cd leveldb
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Release .. && cmake --build .
make install
cd ../../
git clone https://github.com/reeze/php-leveldb.git
cd php-leveldb
phpize
./configure --with-leveldb
make
make install
```

Make sure you've enabled leveldb.so extension in your php.ini.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2708d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec653e6695015eb0781b3b4fbd07e72b67ea8969b38a922ceb8011a0f60900f6?d=identicon)[andkom](/maintainers/andkom)

---

Top Contributors

[![andkom](https://avatars.githubusercontent.com/u/150830?v=4)](https://github.com/andkom "andkom (45 commits)")

---

Tags

bitcoinbitcoin-blockchainbitcoin-blocksbitcoin-protocolphpphp-librarydatabasebitcoinblockchain

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andkom-php-bitcoin-blockchain/health.svg)

```
[![Health](https://phpackages.com/badges/andkom-php-bitcoin-blockchain/health.svg)](https://phpackages.com/packages/andkom-php-bitcoin-blockchain)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[doctrine/doctrine-bundle

Symfony DoctrineBundle

4.8k241.3M3.3k](/packages/doctrine-doctrine-bundle)[doctrine/migrations

PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful tool.

4.8k204.8M440](/packages/doctrine-migrations)[doctrine/data-fixtures

Data Fixtures for all Doctrine Object Managers

2.9k136.1M516](/packages/doctrine-data-fixtures)[robmorgan/phinx

Phinx makes it ridiculously easy to manage the database migrations for your PHP app.

4.5k46.2M405](/packages/robmorgan-phinx)

PHPackages © 2026

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