xiaohuasheng0x1 / tron-php-co
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
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/xiaohuasheng0x1/tron-php-co
Requires
- php: >=8.0
 - ext-swoole: *
 - ionux/phactor: 1.0.8
 - kornrunner/keccak: ~1.0
 - swoole/ide-helper: ^5.0
 - xiaohuasheng0x1/tron-api-co: ~1.0
 - xiaohuasheng0x1/web3-php-co: ^1.0
 
Requires (Dev)
- phpunit/phpunit: ~7.5 || ~9.0
 
This package is auto-updated.
Last update: 2025-10-28 04:49:11 UTC
README
English | δΈζ
tron-php-co
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
- One set of scripts is compatible with all TRX currencies and TRC20 certifications in the TRON network
 - 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
composer require xiaohuasheng0x1/tron-php-co
Interface
use Swlib\Saber; $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
| Name | description | Scenes | 
|---|---|---|
| iexbase/tron-api-co | TRON official document recommends PHP extension package | TRON basic API | 
ππ
Cooperate
Contact
- TG: @X_H_S_001