PHPackages                             invoice/block-chain-data - 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. invoice/block-chain-data

ActiveLibrary

invoice/block-chain-data
========================

区块链账本

1.1(6y ago)2181PHP

Since Jun 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/ofancn/block-chain-data)[ Packagist](https://packagist.org/packages/invoice/block-chain-data)[ RSS](/packages/invoice-block-chain-data/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

BlockChainData
==============

[](#blockchaindata)

区块链账本

安装
--

[](#安装)

```
composer require invoice/block-chain-data
```

用法
--

[](#用法)

```
use Invoice\BlockChainData;

//创建账本
$BlockChain = new BlockChainData('BlockChain.dat');

//新增块
for ($i = 0; $i < 10; $i++) {
    $BlockChain->addBlock('test'.$i);
}

//返回账本Hash
print_r($hash=$BlockChain->getHash());

//返回块数量
var_dump($BlockChain->count());

//校对账本是否被修改
var_dump($BlockChain->verifyHash($hash));

/**
* 分页查询账本
* @param int $limit 条数
* @param int $offset 偏移
* @throws Exception 区块链被破坏
* @return null|array
*/
print_r($BlockChain->find($limit = 1, $offset = 0));

/**
* 返回所有账本数据
* @throws Exception 区块链被破坏
* @return null|array
*/
print_r($BlockChain->findAll());
```

```
cf306668448c89fac6492293c50bbd9bea29ca119d658037ebbe6207382317e2
int(10)
bool(true)
Array
(
    [0] => Array
        (
            [id] => 1
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 0000000000000000000000000000000000000000000000000000000000000000
            [blockhash] => 59011e78236a8446db225a7512584b612224e4fa48b6669d959efcb3b46ff807
            [datalen] => 16
            [data] => test0
        )

)
Array
(
    [0] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 0000000000000000000000000000000000000000000000000000000000000000
            [blockhash] => 59011e78236a8446db225a7512584b612224e4fa48b6669d959efcb3b46ff807
            [datalen] => 16
            [data] => test0
        )

    [1] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 59011e78236a8446db225a7512584b612224e4fa48b6669d959efcb3b46ff807
            [blockhash] => 5cf6e72b4a7debc047d81a41f8b7ad295bf6e7d9144f6718ebfa5c6ff5fd1ee2
            [datalen] => 16
            [data] => test1
        )

    [2] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 5cf6e72b4a7debc047d81a41f8b7ad295bf6e7d9144f6718ebfa5c6ff5fd1ee2
            [blockhash] => 964ef1e93733cea514e2aa1fa3ad50d75195b14be2a2012464ed699541fea154
            [datalen] => 16
            [data] => test2
        )

    [3] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 964ef1e93733cea514e2aa1fa3ad50d75195b14be2a2012464ed699541fea154
            [blockhash] => 6516d2bdcd13353b778f68b8533572a38e7a54c22204306f4262cfde6fe840c7
            [datalen] => 16
            [data] => test3
        )

    [4] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 6516d2bdcd13353b778f68b8533572a38e7a54c22204306f4262cfde6fe840c7
            [blockhash] => 9d07d85bcdeb3443661c7c72403396b8ee49e98b3f9e1f015e5e425a2d5d2814
            [datalen] => 16
            [data] => test4
        )

    [5] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 9d07d85bcdeb3443661c7c72403396b8ee49e98b3f9e1f015e5e425a2d5d2814
            [blockhash] => 249f2119070fb533fa37151db0df6a8bc7a8c53eca07eb14a204d6d85baff94a
            [datalen] => 16
            [data] => test5
        )

    [6] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 249f2119070fb533fa37151db0df6a8bc7a8c53eca07eb14a204d6d85baff94a
            [blockhash] => 86f932ace79d51bca7e9052b23f76b27c4aef26825e892e18eb8d8c28951a5e5
            [datalen] => 16
            [data] => test6
        )

    [7] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 86f932ace79d51bca7e9052b23f76b27c4aef26825e892e18eb8d8c28951a5e5
            [blockhash] => 13743c728e6403586e4aa71445870d128c1d9d1aa89cab4c716876aeb4fc3377
            [datalen] => 16
            [data] => test7
        )

    [8] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 13743c728e6403586e4aa71445870d128c1d9d1aa89cab4c716876aeb4fc3377
            [blockhash] => 8a06b67f38c785340826ddfbf5bc5ed479a0edda70005d8e4b59e2e51f944aad
            [datalen] => 16
            [data] => test8
        )

    [9] => Array
        (
            [id] => 0
            [magic] => d5e8a97f
            [version] => 1
            [timestamp] => 1559583436
            [prevhash] => 8a06b67f38c785340826ddfbf5bc5ed479a0edda70005d8e4b59e2e51f944aad
            [blockhash] => 0e3922eed9b5f5f846285ed4b238ca6ef319106eae55671b18bbead765d6bbd3
            [datalen] => 16
            [data] => test9
        )

)
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~1 days

Total

2

Last Release

2536d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d8ec175cba785ce9881ae0f15648b88895bed17c6968a58a2ae436996a02bef?d=identicon)[invoice](/maintainers/invoice)

---

Top Contributors

[![ofancn](https://avatars.githubusercontent.com/u/38897378?v=4)](https://github.com/ofancn "ofancn (7 commits)")

---

Tags

datablockchain

### Embed Badge

![Health badge](/badges/invoice-block-chain-data/health.svg)

```
[![Health](https://phpackages.com/badges/invoice-block-chain-data/health.svg)](https://phpackages.com/packages/invoice-block-chain-data)
```

###  Alternatives

[fakerphp/faker

Faker is a PHP library that generates fake data for you.

3.9k358.5M3.5k](/packages/fakerphp-faker)[nelmio/alice

Expressive fixtures generator

2.5k43.4M133](/packages/nelmio-alice)[dflydev/dot-access-data

Given a deep data structure, access data by dot notation.

718359.1M86](/packages/dflydev-dot-access-data)[doctrine/mongodb-odm

PHP Doctrine MongoDB Object Document Mapper (ODM) provides transparent persistence for PHP objects to MongoDB.

1.1k23.3M302](/packages/doctrine-mongodb-odm)[sonata-project/exporter

Lightweight Exporter library

44920.9M35](/packages/sonata-project-exporter)[theofidry/alice-data-fixtures

Nelmio alice extension to persist the loaded fixtures.

32528.5M70](/packages/theofidry-alice-data-fixtures)

PHPackages © 2026

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