Download the PHP package paywithterra/php-backend-library without Composer

On this page you can find all versions of the php package paywithterra/php-backend-library. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-backend-library

PaywithTerra Backend PHP Library

PHP library for validating payment transactions on Terra blockchain.

Prerequisites

PHP version 5.6, 7.0, 7.1, 7.2, 7.3, or 7.4
PHP extensions: ext-json, ext-curl

Installation

You can use Composer. Follow the installation instructions if you do not already have composer installed.

composer require paywithterra/php-backend-library

In your PHP script, make sure you include the Composer's autoloader:

require __DIR__ . '/vendor/autoload.php';

Alternatively, when you are not using Composer, you can download the release on GitHub and use library directly:

require __DIR__ . '/src/autoload-legacy.php';

Using the library

Request and validate transaction

// Prepare client (see all options below)
$client = new \PaywithTerra\TerraTxValidator([
    "merchantAddress" => "terra12abcdefg1234512345123451234512345abc",
    "chainId" => "pisco-1",
    "LCD" => "https://pisco-lcd.terra.dev/cosmos/tx/v1beta1/txs/{txHash}",
]);

// Request transaction information from public facade (by txHash)
$client->lookupTx("TynpStpmcovsgsNpqlchimy9cydlc83bwudgrBigShTksrzczfvxnf9q4kkvcek4");

// Check if transaction comply with our requirements (throw exception if not)
$client->assertTx([
    "memo" => '#order-1234',
    "denom" => "uluna",
    "amount" => "280000",
]);

Client options (initialization variants)

Variant 1: Using exact LCD and chainId

$client = new \PaywithTerra\TerraTxValidator([
    "merchantAddress" => "terra12abcdefg1234512345123451234512345abc",
    "chainId" => "pisco-1",
    "LCD" => "https://pisco-lcd.terra.dev/cosmos/tx/v1beta1/txs/{txHash}",
]);

Variant 2: Using exact FCD and chainId

$client = new \PaywithTerra\TerraTxValidator([
    "merchantAddress" => "terra12abcdefg1234512345123451234512345abc",
    "chainId" => "pisco-1",
    "FCD" => "https://pisco-fcd.terra.dev/v1/tx/{txHash}",
]);

Variant 3: Using network name (requests chains info + LCD url from Terra network and cache it)

$client = new \PaywithTerra\TerraTxValidator([
    "merchantAddress" => "terra12abcdefg1234512345123451234512345abc",
    "networkName" => "testnet", // or "mainnet" or "classic"
    "cache" => new \PaywithTerra\Cache\FileCache(),
]);

Assets (denoms) support

Denom code Asset name / Description
uluna Luna
Default (basic) network asset
ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4 axlUSDC (mainnet)
The USDC representation in Terra network (can be swapped from Luna right on Station Mobile)
ibc/CBF67A2BCF6CAE343FDF251E510C8E18C361FC02B23430C121116E0811835DEF axlUSDT (mainnet)
The Tether representation in Terra network (can be swapped from Luna right on Station Mobile)

Notes

We don't use any of modern libraries (like Guzzle or Symphony HTTP Client) as transport because we want to keep the minimal supported PHP version as low as possible.
This approach allows even old-school and legacy PHP-projects to connect to Terra. If you really want to use HTTP clients as transport, please open an issue.

License

The MIT License (MIT)


All versions of php-backend-library with dependencies

PHP Build Version
Package Version
Requires ext-json Version *
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package paywithterra/php-backend-library contains the following files

Loading the files please wait ....