hub/hedera-sdk-php
Composer 安装命令:
composer require hub/hedera-sdk-php
包简介
Hedera Hashgraph SDK for PHP - A comprehensive PHP library for interacting with the Hedera network
README 文档
README
Rationale
GRPC php bindings for hedera API. Compatible with php7.2+ (until 8.1 at least).
Process
- Install or build protocol buffers compiler (
protoc) with php plugins. Instructions from https://grpc.io/docs/languages/php/quickstart/
git clone --recurse-submodules -b v1.75.1 --depth 1 --shallow-submodules https://github.com/grpc/grpc bazel build @com_google_protobuf//:protoc //src/compiler:all v1.75.1 # bazel does not work with 1.40 #git clone --recurse-submodules -b v1.40.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc #bazel build @com_google_protobuf//:protoc //src/compiler:all v1.40.0
- Clone protocol buffers specs from official hedera repo.
git clone https://github.com/hashgraph/hedera-protobufs/releases/tag/v0.62.4
- Generate php stubs for desired protocol buffers packages.
protoc --descriptor_set_out=out.protoset --include_imports --proto_path=./services --proto_path=./platform services/*.proto ../grpc/bazel-bin/external/com_google_protobuf/protoc --descriptor_set_out=out.protoset --include_imports --proto_path=../grpc/third_party/protobuf/src/ --proto_path=./services --proto_path=./mirror --proto_path=./platform --php_out=../hedera-php/Generatedmirror2 --grpc_out=../hedera-php/Generatedmirror2 --plugin=protoc-gen-grpc=../grpc/bazel-bin/src/compiler/grpc_php_plugin_binary mirror/*.proto ../grpc/bazel-bin/external/com_google_protobuf/protoc --descriptor_set_out=out.protoset --include_imports --proto_path=../grpc/third_party/protobuf/src/ --proto_path=./services --proto_path=./platform --proto_path=./platform/event --proto_path=./platform/state --php_out=../hedera-php/Generated --grpc_out=../hedera-php/Generated --plugin=protoc-gen-grpc=../grpc/bazel-bin/src/compiler/grpc_php_plugin_binary services/*.proto ../grpc/bazel-bin/external/com_google_protobuf/protoc --descriptor_set_out=out.protoset --include_imports --proto_path=../grpc/third_party/protobuf/src/ --proto_path=./services --proto_path=./platform --proto_path=./platform/event --proto_path=./platform/state --php_out=../hedera-php/Generatedplatformevent --grpc_out=../hedera-php/Generatedplatformevent --plugin=protoc-gen-grpc=../grpc/bazel-bin/src/compiler/grpc_php_plugin_binary platform/event/*.proto ../grpc/bazel-bin/external/com_google_protobuf/protoc --descriptor_set_out=out.protoset --include_imports --proto_path=../grpc/third_party/protobuf/src/ --proto_path=./services --proto_path=./platform --proto_path=./platform/event --proto_path=./platform/state --php_out=../hedera-php/Generatedauxiliaryhints --grpc_out=../hedera-php/Generatedauxiliaryhints --plugin=protoc-gen-grpc=../grpc/bazel-bin/src/compiler/grpc_php_plugin_binary services/auxiliary/hints/*.proto ../grpc/bazel-bin/external/com_google_protobuf/protoc --descriptor_set_out=out.protoset --include_imports --proto_path=../grpc/third_party/protobuf/src/ --proto_path=./services --proto_path=./platform --proto_path=./platform/event --proto_path=./platform/state --php_out=../hedera-php/Generatedstatehints --grpc_out=../hedera-php/Generatedstatehints --plugin=protoc-gen-grpc=../grpc/bazel-bin/src/compiler/grpc_php_plugin_binary services/state/hints/*.proto ../grpc/bazel-bin/external/com_google_protobuf/protoc --descriptor_set_out=out.protoset --include_imports --proto_path=../grpc/third_party/protobuf/src/ --proto_path=./services --proto_path=./platform --proto_path=./platform/event --proto_path=./platform/state --php_out=../hedera-php/Generatedauxiliaryhistory --grpc_out=../hedera-php/Generatedauxiliaryhistory --plugin=protoc-gen-grpc=../grpc/bazel-bin/src/compiler/grpc_php_plugin_binary services/auxiliary/history/*.proto ../grpc/bazel-bin/external/com_google_protobuf/protoc --descriptor_set_out=out.protoset --include_imports --proto_path=../grpc/third_party/protobuf/src/ --proto_path=./services --proto_path=./platform --proto_path=./platform/state --php_out=../hedera-php/Generatedstatehistory --grpc_out=../hedera-php/Generatedstatehistory --plugin=protoc-gen-grpc=../grpc/bazel-bin/src/compiler/grpc_php_plugin_binary services/state/history/*.proto
-
Build higher-level wrappers around the raw clients.
-
Build required grpc extensions.
# PECL setup for debian-based systems apt install php-dev php-pear composer pecl install grpc-1.76.0 # Config for php v 8.1 echo -e "; configuration for php grpc module\n; priority=20\nextension=grpc.so\n" > /etc/php/8.1/mods-available/grpc.ini ln -s /etc/php/8.1/mods-available/grpc.ini /etc/php/8.1/cli/conf.d/20-grpc.ini
Improvements
- increase tests coverage.
- exhaustive features integrations (basically, only HCS is integrated now).
- separate mirror client from main client and avoid namespace clash between "ConsensusService".
- Transform precheck codes enums to more user friendly messages.
- More flexible interface to customize any internal parameter, inspired from other non-PHP SDKs like https://github.com/hiero-ledger/hiero-sdk-js.
- Expose internal types/messages or build a more friendly wrapper around them (eg: handle topicId like strings and parse internally into realm, shard and num).
- Include hbar to tinybar utilities and arbitrary precision operations.
- Autodetect node number from node host or viceversa by using AddressBooks.
- Autodetect account number from public key or viceversa.
- Allow to perform EVM compatible operations.
- Improve fee handling and trx payment.
- Support EVM compatible layer (ECDSA encryption would be needed then).
- Integrate with mirror JSON-RPC interfaces for old transactions.
hub/hedera-sdk-php 适用场景与选型建议
hub/hedera-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「sdk」 「blockchain」 「protobuf」 「cryptocurrency」 「gRPC」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hub/hedera-sdk-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hub/hedera-sdk-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hub/hedera-sdk-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The BlockTrail PHP SDK, for integration of Bitcoin functionality through the BlockTrail API
Solana PHP SDK for interacting with the Solana blockchain
A fast and dynamic Merkle tree implementation
Multichain JSON-RPC Client
Alfabank REST API integration
Implementation of Bitclout API interaction through its node
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-29