PHPackages                             terragreen/terragreen-official-api-docs-master - 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. terragreen/terragreen-official-api-docs-master

ActiveLibrary[API Development](/categories/api)

terragreen/terragreen-official-api-docs-master
==============================================

PHP TerraGreen API is an asynchronous PHP library for the TerraGreen API designed to be easy to use.

08PHP

Since Jul 15Pushed 6y agoCompare

[ Source](https://github.com/TERRAGREEN/php-terragreen-api)[ Packagist](https://packagist.org/packages/terragreen/terragreen-official-api-docs-master)[ RSS](/packages/terragreen-terragreen-official-api-docs-master/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP TerraGreen API
==================

[](#php-terragreen-api)

General API Features
--------------------

[](#general-api-features)

- Implementation of all General, Market Data and Accounting Related Data.
- Simple handling of authentication
- Manage Wallet, Transaction Details, Rates, And Block Details.
- Exception Handling.
- API Response in different formats like JSON &amp; XML.
- Unique API Key &amp; Secret Key provided to each user.

API key
-------

[](#api-key)

To use Terragreen API, the user will need to obtain an API key and secret key, which are passed to TerraGreen API with every request. API keys can be generated in the TerraGreen BlockChain Portal, under the section 'API KEYS'. Direct link to API key creation panel:[Click Here](http://blockchain.terragreen.io/Api/ApiCreate)

Steps to obtain an API Key and Secret key:

1. Create an account at BlockChain portal. [click here](http://blockchain.terragreen.io/Account/Register)
2. Verify your account
3. SignIn at BlockChain portal [click here](http://blockchain.terragreen.io/Account/Login)
4. Go to API Key section [click here](http://blockchain.terragreen.io/Docs/Index)
5. Create API Key [click here](http://blockchain.terragreen.io/Api/ApiCreate)

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

[](#installation)

Install the library using Composer. Please read the [Composer Documentation](https://getcomposer.org/doc/01-basic-usage.md) if you are unfamiliar with Composer or dependency managers in general. ```
composer require terragreen/terragreen-official-api-docs-master
```

### Getting started

[](#getting-started)

Set Below parameters in config.php file, which you obtain from BlockChain portal.

```
$API_KEY = "[API_KEY]";
$SECRECT_KEY="[SECRECT_KEY]";
$EMAIL_ADDRESS="[EMAIL_ADDRESS]";
$USERNAME="[WALLET_NAME]";
$PASSWORD="[PASSWORD]";
$SEND_ADDRESS="[SEND_ADDRESS]";
```

Add Namespace &amp; Below Config Files for all operations

```
use TerraGreen\TGNAPI; //Main Class Library
require_once 'vendor/autoload.php'; // Autoload files using Composer autoload
require_once 'vendor/config.php'; // Autoload data using config file

```

Block
=====

[](#block)

### Get Blocks Details

[](#get-blocks-details)

Get block details.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$BlockId = 375808;
$response =  $api->GetBlockDetails($BlockId);
echo json_encode($response);

```

### Get Blocks

[](#get-blocks)

Get Blocklist.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$start = 1;
$end = 5;
$response =  $api->GetBlockDetails($start,$end);
echo json_encode($response);

```

### Get Latest Block

[](#get-latest-block)

Gets latest block list.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->GetLatestBlock();
echo json_encode($response);

```

Rate
====

[](#rate)

### Get Rate

[](#get-rate)

Get TGCoin's current rates.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->CurrentRate();
echo json_encode($response);

```

### Get All Rate

[](#get-all-rate)

Get TGCoin rates.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->GetAllRate();
echo json_encode($response);

```

Transaction
===========

[](#transaction)

### Get New Address

[](#get-new-address)

Get new receive address.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->GetNewAddress();
echo json_encode($response);

```

### Send Balance

[](#send-balance)

Send amount to other user's wallet.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$amount = 2.1;
$response =  $api->SendBalance($SEND_ADDRESS,$amount);
echo json_encode($response);

```

### Get Transaction List

[](#get-transaction-list)

Get transaction list of the user.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->GetTransactionList();
echo json_encode($response);

```

### Verify Payment

[](#verify-payment)

Verify transaction's payment status.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->VerifyPaymentStatus($SEND_ADDRESS);
echo json_encode($response);

```

Wallet
======

[](#wallet)

### Create Wallet

[](#create-wallet)

Create Wallet Account.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->CreateWallet();
echo json_encode($response);

```

### Get Initialize

[](#get-initialize)

Get access-token to access all authorized apis.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->GetInitialize();
echo json_encode($response);

```

### Get Balance

[](#get-balance)

Get Wallet Balance.

```
$api = new TGNAPI($API_KEY, $SECRECT_KEY,$EMAIL_ADDRESS,$USERNAME,$PASSWORD);
$response =  $api->GetBalance();
echo json_encode($response);

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5023ae01e05b282d29b67f9f085fe9078045a087e7448a1e30d922b4e7ea457?d=identicon)[tgncoin](/maintainers/tgncoin)

---

Top Contributors

[![TERRAGREEN](https://avatars.githubusercontent.com/u/44187811?v=4)](https://github.com/TERRAGREEN "TERRAGREEN (71 commits)")

### Embed Badge

![Health badge](/badges/terragreen-terragreen-official-api-docs-master/health.svg)

```
[![Health](https://phpackages.com/badges/terragreen-terragreen-official-api-docs-master/health.svg)](https://phpackages.com/packages/terragreen-terragreen-official-api-docs-master)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M19](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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