PHPackages                             sultanov-solutions/tron-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. sultanov-solutions/tron-api

ActiveLibrary[API Development](/categories/api)

sultanov-solutions/tron-api
===========================

A PHP API for interacting with Tron (Trx)

5.0.10(8mo ago)0920MITPHPPHP ^8.1CI passing

Since Aug 31Pushed 8mo agoCompare

[ Source](https://github.com/sultanov-solutions/tron-api)[ Packagist](https://packagist.org/packages/sultanov-solutions/tron-api)[ Docs](https://github.com/sultanov-solutions/tron-api)[ RSS](/packages/sultanov-solutions-tron-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (11)Used By (0)

TRON API
========

[](#tron-api)

A PHP API for interacting with the Tron Protocol

[![Tests](https://github.com/sultanov-solutions/tron-api/actions/workflows/tests.yml/badge.svg)](https://github.com/sultanov-solutions/tron-api/actions/workflows/tests.yml)[![Packagist](https://camo.githubusercontent.com/c2145c7204a20c93c14d68bf7a38466d74b9d7adfda585240a26cf8209bbf7d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73756c74616e6f762d736f6c7574696f6e732f74726f6e2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sultanov-solutions/tron-api)[![PHP](https://camo.githubusercontent.com/b72fc539a561204dbaa6c4acbf62bf101e1848454792ef9a2ba278f342d76bf1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73756c74616e6f762d736f6c7574696f6e732f74726f6e2d6170692e7376673f7374796c653d666c61742d737175617265)](composer.json)[![Laravel](https://camo.githubusercontent.com/588129d149873e2040c30e633b2fd52b8cfee7f15c9843c034a0818f1c59f326/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3132253230636f6d70617469626c652d4646324432303f6c6f676f3d6c61726176656c267374796c653d666c61742d737175617265)](#)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

[![Latest Stable Version](https://camo.githubusercontent.com/0d30db52957ee000b046486a7f353b0bc4836fd80135497e42961e4e1242e63c/68747470733a2f2f706f7365722e707567782e6f72672f73756c74616e6f762d736f6c7574696f6e732f74726f6e2d6170692f76657273696f6e)](https://packagist.org/packages/sultanov-solutions/tron-api)[![Build Status](https://camo.githubusercontent.com/1bf587440f3d2bd865dd155b838d9b6c7a288a225141cd393b6d3b235ccb47c8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73756c74616e6f762d736f6c7574696f6e732f74726f6e2d6170692f74657374732e796d6c3f7374796c653d666c61742d737175617265266c6162656c3d6275696c64)](https://github.com/sultanov-solutions/tron-api/actions/workflows/tests.yml)[![Contributors](https://camo.githubusercontent.com/909270fc5d519e9cfbec60e08620f3d909fad8bbb5181095e9e9635f075f2266/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f73756c74616e6f762d736f6c7574696f6e732f74726f6e2d6170692e7376673f7374796c653d666c61742d737175617265)](https://github.com/sultanov-solutions/tron-api/graphs/contributors)[![Total Downloads](https://camo.githubusercontent.com/198fd79dd8846c3f708c3a993708316397258647efacac21404406bf87169521/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73756c74616e6f762d736f6c7574696f6e732f74726f6e2d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sultanov-solutions/tron-api)

Fork &amp; Credits
------------------

[](#fork--credits)

This project is a maintained fork of . Full credit to the original authors and contributors of the upstream project. This fork focuses on PHP 8+ and Laravel 12 compatibility, dependency hygiene, CI/release tooling, and small fixes.

Installation
------------

[](#installation)

```
# latest stable
composer require sultanov-solutions/tron-api

# or pin to the current major/minor
composer require sultanov-solutions/tron-api:^5.0.2
```

Requirements
------------

[](#requirements)

- PHP: ^8.1
- Extensions: ext-json, ext-bcmath, ext-mbstring, ext-gmp
- Guzzle 7.x (installed transitively)
- web3p/web3.php ^0.1.6 (installed transitively)

This library is framework-agnostic and compatible with Laravel 12.

Features
--------

[](#features)

- Standalone and Laravel integration without hard coupling
- Explicit instance creation (no hidden singletons)
- Network presets: mainnet, shasta, nile; custom endpoints support
- Rotating API keys in Laravel (round-robin, persisted via Cache)
- PSR-7 friendly HTTP with Guzzle (core) or Laravel Http client (adapter)
- PHP 8.1+, clean dependencies, CI and release workflows

Usage
-----

[](#usage)

### Standalone

[](#standalone)

```
use IEXBase\TronAPI\Tron;

// Defaults to mainnet
$tron = Tron::init();

// Or with options / network preset
$tron = Tron::init([
    'network' => 'shasta',
    // 'api_key' => 'YOUR_TRONGRID_KEY',
    // 'endpoints' => ['full_node' => 'https://...', 'solidity_node' => 'https://...']
]);

$tron->setAddress('TYourAddressBase58OrHex');
$balance = $tron->getBalance(null, true);
```

Configuration (Laravel)
-----------------------

[](#configuration-laravel)

`config/tron-connection.php` controls default connection and per-connection options:

- `default`: connection name (e.g., `mainnet`)
- `connections.{name}.network`: `mainnet` | `shasta` | `nile` | `custom`
- `connections.{name}.endpoints`: `full_node`, `solidity_node`, `event_server`, `status_page`
- `timeout_ms`, `headers`, `auth` (basic/bearer), `api_key`(s)
- optional: `private_key`, `address`

ENV examples:

```
TRON_DEFAULT=mainnet
TRON_FULLNODE=https://api.trongrid.io
TRON_SOLIDITY_NODE=https://api.trongrid.io
TRON_EVENT_SERVER=https://api.trongrid.io
TRON_API_KEY=key1,key2,key3
TRON_TIMEOUT_MS=30000

```

### Laravel 12

[](#laravel-12)

1. Publish config:

```
php artisan vendor:publish --tag=tron-connection-config
```

2. Create a fresh connection and use it explicitly:

```
use IEXBase\TronAPI\Laravel\Facades\Tron; // or app('tron')

// Fresh instance for default connection from config
$tron = Tron::make();

// Or choose connection + override options for this instance
$tron = Tron::make('shasta', ['timeout_ms' => 20000, 'api_key' => 'TEST_KEY']);

$balance = $tron->getBalance(null, true);
```

This library deliberately does not expose a singleton Tron instance in Laravel — every `make(...)` returns a new, predictable instance configured from arguments and config.

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

Donations
---------

[](#donations)

If this library is useful for you, you may support the original project or this fork’s maintenance (TRON/TRX addresses):

- Original author (IEXBase): TRWBqiqoFZysoAeyR1J35ibuyc8EvhUAoY
- Maintainer (Sultanov Solutions): TPgGPSJ37t4nFGyYa7TQxwLZFJMvK587QT

Changelog
---------

[](#changelog)

See `CHANGELOG.md` for release notes.

API Key Rotation (Laravel)
--------------------------

[](#api-key-rotation-laravel)

- Set multiple TronGrid/Tronscan API keys as a comma-separated list in `.env`:

```
TRON_API_KEY=key1,key2,key3

```

- Each `Tron::make(...)` picks the next key in a round-robin fashion and persists the index in Cache.
- You can override rotation per instance by passing an explicit key:

```
$tron = \IEXBase\TronAPI\Laravel\Facades\Tron::make('mainnet', ['api_key' => 'OVERRIDE_KEY']);
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance59

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

9

Last Release

260d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c6a5a5a0138a0acab66a5332114bed2b9dc4a8ca46280610d8a804fd5548252?d=identicon)[cljamal](/maintainers/cljamal)

---

Top Contributors

[![serderovsh](https://avatars.githubusercontent.com/u/24723913?v=4)](https://github.com/serderovsh "serderovsh (248 commits)")[![cljamal](https://avatars.githubusercontent.com/u/9625526?v=4)](https://github.com/cljamal "cljamal (24 commits)")[![1099511627776](https://avatars.githubusercontent.com/u/2117414?v=4)](https://github.com/1099511627776 "1099511627776 (19 commits)")[![kaankozan](https://avatars.githubusercontent.com/u/38933295?v=4)](https://github.com/kaankozan "kaankozan (9 commits)")[![sharifzadesina](https://avatars.githubusercontent.com/u/205923701?v=4)](https://github.com/sharifzadesina "sharifzadesina (3 commits)")[![sashabeton](https://avatars.githubusercontent.com/u/23243361?v=4)](https://github.com/sashabeton "sashabeton (2 commits)")[![dogdev](https://avatars.githubusercontent.com/u/4762407?v=4)](https://github.com/dogdev "dogdev (1 commits)")

---

Tags

iexbasetron-libtron-phptron-apitron-rest-api

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sultanov-solutions-tron-api/health.svg)

```
[![Health](https://phpackages.com/badges/sultanov-solutions-tron-api/health.svg)](https://phpackages.com/packages/sultanov-solutions-tron-api)
```

###  Alternatives

[iexbase/tron-api

A PHP API for interacting with Tron (Trx)

437136.9k8](/packages/iexbase-tron-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
