GitPedia

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

From FenguozΒ·Updated June 23, 2026Β·View on GitHubΒ·

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 The project is written primarily in PHP, distributed under the MIT License license, first published in 2021. Key topics include: php, rpc, trc20, tron, trx.

Latest release: 2.1.0β€” Releases 2.1.0
August 17, 2024View Changelog β†’

English | δΈ­ζ–‡

<h1 align="center">TRON-PHP</h1> <p align="center"> <a href="https://github.com/Fenguoz/tron-php/releases"><img src="https://poser.pugx.org/Fenguoz/tron-php/v/stable" alt="Stable Version"></a> <a href="https://www.php.net"><img src="https://img.shields.io/badge/php-%3E=7.2-brightgreen.svg?maxAge=2592000" alt="Php Version"></a> <a href="https://github.com/Fenguoz/tron-php/blob/master/LICENSE"><img src="https://img.shields.io/github/license/fenguoz/tron-php.svg?maxAge=2592000" alt="tron-php License"></a> <a href="https://packagist.org/packages/Fenguoz/tron-php"><img src="https://poser.pugx.org/Fenguoz/tron-php/downloads" alt="Total Downloads"></a> </p>

Introduction

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

Advantage

  1. One set of scripts is compatible with all TRX currencies and TRC20 certifications in the TRON network
  2. Interface methods can be added or subtracted flexibly

Support Method

  • Generate address generateAddress()
  • Verify address validateAddress(Address $address)
  • Get the address according to the private key privateKeyToAddress(string $privateKeyHex)
  • Check balances balance(Address $address)
  • Transaction transfer (offline signature) transfer(string $from, string $to, float $amount)
  • Query the latest block blockNumber()
  • Query information according to the blockchain blockByNumber(int $blockID)
  • *Query information based on transaction hash transactionReceipt(string $txHash)

Quick Start

Install

PHP8

php
composer require fenguoz/tron-php

or PHP7

php
composer require fenguoz/tron-php ~1.3

Interface

php
use GuzzleHttp\Client; $uri = 'https://api.trongrid.io';// mainnet // $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, $config); $addressData = $trc20Wallet->generateAddress();

Plan

  • Support TRC10
  • Smart Contract

Package

NamedescriptionScenes
Fenguoz/tron-apiTRON official document recommends PHP extension packageTRON basic API

🌟🌟

Stargazers over time

Cooperate

Contact

  • WX:zgf243944672
  • QQ:243944672

Contributors

Showing top 3 contributors by commit count.

View all contributors on GitHub β†’

This article is auto-generated from Fenguoz/tron-php via the GitHub API.Last fetched: 6/25/2026