Download the PHP package amashukov/toncenter-client-php without Composer

On this page you can find all versions of the php package amashukov/toncenter-client-php. 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 toncenter-client-php

amashukov/toncenter-client-php

Typed PHP toncenter v2 client for The Open Network — PSR-18 transport, {ok, result} envelope unwrapping, retry-aware, typed Value Objects.

CI PHPStan L9 Latest Version Downloads PHP Stars

A typed PHP client for the toncenter v2 HTTP API on The Open Network (TON). It speaks any PSR-18 HTTP client, unwraps the {ok, result} envelope into typed exceptions in one place, and returns Value Objects instead of loose arrays — masterchain info, account state, a run-get-method stack reader, and typed transactions. TON balances exceed PHP_INT_MAX past ~9,223 TON, so every nano-TON value comes back as a decimal string, never a lossy float. Includes ToncenterWalletRpc, a drop-in WalletRpcInterface adapter for ton-wallet-php.

Features

Why amashukov/toncenter-client-php

The common alternative is hand-rolled Guzzle calls scattered across a service layer, each re-implementing envelope checks, bigint parsing, and 542/429 retry logic. This package centralizes all of that behind a typed surface with PHPStan level 9, returns Value Objects instead of arrays, and stays transport-agnostic so retry / API-key concerns live in your PSR-18 pipeline.

Installation

Usage

Any PSR-18 client and PSR-17 factory pair works. The example below wires amashukov/http-client-php (cURL transport + retry / header-injection middleware) with nyholm/psr7 for the PSR-7 messages:

Logging

Pass any PSR-3 logger (Psr\Log\LoggerInterface, e.g. Monolog or a framework's logger) as the last constructor argument; without one the client logs nothing.

Reading get-method results

The stack reader is a cursor over a TON TupleItem sum-type (TonTupleItemInt / Cell / Slice / Builder / Null / Tuple) and decodes both decimal and 0x-prefixed bigints via GMP.

Following a message to its result

tryLocateResultTx asks toncenter for the transaction in which the destination processed one internal message, so it does not page through the destination's history and answers the same for a quiet wallet and for an exchange address with thousands of transactions a minute. It returns null while the transaction is not known yet.

Broadcasting a wallet transfer

API

Method Returns
getMasterchainInfo() TonMasterchainInfo
getBalance(string $address) string (decimal nano-TON)
getAddressInformation(string $address) TonAccountInfo
isContractDeployed(string $address) bool
getTypedTransactions(string $address, array $opts = []) list<TonTransaction>
getTypedTransaction(string $address, string $lt, string $hash) TonTransaction
tryLocateResultTx(string $source, string $destination, string $createdLt) ?TonTransaction
runMethod(string $address, string $method, array $stack = []) TonRunMethodResult
sendBoc(string $bocBase64) TonSendBocResult

Requirements

Related packages

Package Role
amashukov/ton-wallet-php Wallet v4r2 + WalletRpcInterface this client adapts (dependency)
amashukov/http-client-php PSR-18 cURL client + retry / header-injection middleware
amashukov/ton-cell-php TLB Cell / Builder / BOC layer
amashukov/ton-php TON meta-package
amashukov/blockchain-context-bundle Symfony bundle wiring the whole family

Quality

License

MIT — see LICENSE.

Strict evidence for undeployed accounts

TonAccountInfo::isProvenUninitialized() is suitable for deciding that a contract has no deployed token state. It requires an explicit uninitialized, uninit or nonexist wire state, an unsigned decimal-string native balance, and absent/empty code and data. Missing, unknown or malformed fields never qualify. Native TON may still be present at an undeployed address; this predicate does not mean its native balance is zero. The legacy state normalization and isUninitialized() remain compatible, including their defaults; use the strict predicate for absence decisions. Direct constructor calls have no strict wire evidence by default.

Estimate message fees

estimateFee calls the v2 /estimateFee endpoint without sending a transaction. Pass the base64 message body, not the complete external-message BOC. Optional initCodeBoc and initDataBoc support undeployed accounts. ignoreSignature defaults to true; pass false to require a valid signature during estimation.

TonFeeEstimate preserves sourceFees and the ordered destinationFees list. Each TonFeeBreakdown exposes inForwardFee, storageFee, gasFee and forwardFee as nonnegative decimal strings in nanotons, including explicit zero. Missing, negative, fractional or malformed components raise TonRpcException; large JSON integers are preserved without floating-point conversion. Existing transport/envelope errors and logging apply to estimation as to other methods.

This is an estimate, not a receipt or a guaranteed final charge. The provider may return no destination fees; that does not establish zero downstream cost or full trace coverage. Applications must establish which message executions are covered before using the estimate to price a multi-contract operation.


All versions of toncenter-client-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
ext-gmp Version *
amashukov/ton-cell-php Version ^0.1.0
amashukov/ton-wallet-php Version ^0.1.0
psr/http-client Version ^1.0
psr/http-factory Version ^1.1
psr/http-message Version ^2.0
psr/log Version ^3.0
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 amashukov/toncenter-client-php contains the following files

Loading the files please wait ...