just-luka / php-tron
PHP package for interacting with TRX network
v1.1.1
2025-03-17 17:35 UTC
Requires
- php: >=8.2
- ext-curl: *
- ext-gmp: *
- kornrunner/secp256k1: ^0.3
- simplito/elliptic-php: ^1.0.12
Requires (Dev)
- monolog/monolog: ^3.0
- phpunit/phpunit: *
This package is auto-updated.
Last update: 2025-06-17 18:11:37 UTC
README
A PHP library for interacting with the TRON blockchain.
Package provides user-friendly extension API. The latest version of TronGrid's proprietary API is v1. TronGrid API service has the features of low latency, high consistency, high availability and partition fault tolerance.
Note: In order to ensure the reasonable allocation of requested resources, all request APIs need to include the API Key parameter.
Requests without an API Key will be severely limited or may not receive a response.
Features
- Generate TRON address
- Check account balance
- Check transaction details
- List assets from chain
- List transactions by contract address
Installation
Install the package via Composer:
composer require just-Luka/php-tron
Usage
Initialize the Client (Mainnet)
use Trx\TrxClient; $tron = new TronClient('API-KEY');
Initialize the Client (Shasta Testnet)
use Trx\TrxClient; $tron = new TronClient(testmode: true);
Example
Generate TRON address
$wallet = $tron->wallet()->create(); echo $wallet->getAddress(); echo $wallet->getPrivateKey();
TRON balance
$account = $tron->account('TDrbCtdTj5KMo67mtQw2XXu5eTqwwVYoKz'); echo $account->explore()->balance;
Transactions
$account = $tron->account('TDrbCtdTj5KMo67mtQw2XXu5eTqwwVYoKz'); $transactions = $account->transactions(); # Or $transactions = $account->filterLimit(10)->filterOnlyConfirmed()->transactions(); # Apply filters var_dump($transactions);