sui-php/sdk
Composer 安装命令:
composer require sui-php/sdk
包简介
SUI PHP SDK
README 文档
README
About
SUI PHP SDK is a PHP library that provides easy access to the SUI blockchain. This SDK allows PHP developers to interact with SUI blockchain nodes, create transactions, serialize and deserialize data using Binary Canonical Serialization (BCS), and manage accounts without writing low-level code. It is also fully implemented from the @mysten/sui (https://sdk.mystenlabs.com/typescript) TypeScript library. In other words, it is designed with the same structure there and you can easily find what you need in this library by examining the document in the link.
Key features:
- Network communication with SUI nodes
- BCS serialization and deserialization
- Transaction building and signing
- Account management
Installation
composer require sui-php/sdk
Example
require 'vendor/autoload.php'; use Sui\Utils; use Sui\Client; use Sui\Bcs\Bcs; use Sui\Keypairs\Ed25519\Keypair; use Sui\Transactions\Inputs; use Sui\Transactions\Commands; use Sui\Transactions\Transaction; use Sui\Transactions\BuildTransactionOptions; $client = new Client('https://fullnode.devnet.sui.io:443'); $coin = Bcs::struct('Coin', [ 'value' => Bcs::u64(), 'owner' => Bcs::string(), 'is_locked' => Bcs::bool(), ]); $rustBcs = 'gNGxBWAAAAAOQmlnIFdhbGxldCBHdXkA'; $expected = [ 'owner' => 'Big Wallet Guy', 'value' => '412412400000', 'is_locked' => false, ]; $serialized = $coin->serialize($expected, ['initialSize' => 1, 'maxSize' => 1024]); $parsed = $coin->fromBase64($rustBcs); $ref = [ 'objectId' => str_pad(strval(mt_rand(0, 100000)), 64, '0'), 'version' => strval(mt_rand(0, 10000)), 'digest' => Utils::toBase58(json_decode('[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2 ]')) ]; $keypair = Keypair::generate(); $tx = new Transaction(new BuildTransactionOptions($client)); $tx->setSender($keypair->getPublicKey()->toSuiAddress()); $tx->setGasPrice(5); $tx->setGasBudget(100); $tx->setGasPayment([$ref]); $coin = $tx->splitCoins($tx->gas(), [100]); $tx->add(Commands::mergeCoins($tx->gas(), [$coin, $tx->object(Inputs::objectRef( $ref['objectId'], $ref['digest'], $ref['version'] ))])); $tx->add(Commands::moveCall([ 'target' => '0x2::devnet_nft::mint', 'typeArguments' => [], 'arguments' => [ $tx->pureFactory->string('foo'), $tx->pureFactory->string('bar'), $tx->pureFactory->string('baz'), ], ])); $bytes = $tx->build(); $serializedSignature = $keypair->signTransaction($bytes);
sui-php/sdk 适用场景与选型建议
sui-php/sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 04 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sui-php/sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sui-php/sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 24
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-04-25