定制 fptron/tron-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fptron/tron-php

最新稳定版本:1.0.5

Composer 安装命令:

composer require fptron/tron-php

包简介

Support TRON's TRX and TRC20, which include functions such as address creation, balance query, transaction transfer, query the latest blockchain, query information based on the blockchain, and query information based on the transaction hash

README 文档

README

概述

TRON-PHP 目前支持波场的 TRX 和 TRC20 中常用生成地址,发起转账,离线签名等功能。

特点

  1. 一套写法兼容 TRON 网络中 TRX 货币和 TRC 系列所有通证
  2. 接口方法可可灵活增减

支持方法

  • 生成地址 generateAddress()
  • 验证地址 validateAddress(Address $address)
  • 根据私钥得到地址 privateKeyToAddress(string $privateKeyHex)
  • 查询余额 balance(Address $address)
  • 交易转账(离线签名) transfer(Address $from, Address $to, float $amount)
  • 查询最新区块 blockNumber()
  • 根据区块链查询信息 blockByNumber(int $blockID)
  • 根据交易哈希查询信息 transactionReceipt(string $txHash)

快速开始

安装

composer require fptron/tron-php

接口调用

use GuzzleHttp\Client;

$uri = 'https://api.shasta.trongrid.io';// shasta testnet
$api = new \Tron\Api(new Client(['base_uri' => $uri]));

$trxWallet = new \Tron\TRX($api);
$addressData = $trxWallet->generateAddress();
// $addressData->privateKey
// $addressData->address

$config = [
    'contract_address' => 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',// USDT TRC20
    'decimals' => 6,
];
$trc20Wallet = new \Tron\TRC20($api, $this->config);
$addressData = $trc20Wallet->generateAddress();

计划

  • 支持 TRC10
  • 测试用例
  • ...

扩展包

扩展包名 描述 应用场景
fptron/tron-api 推荐 PHP 扩展包 波场基础Api

统计信息

  • 总下载量: 39
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-23