Pure-PHP TON (The Open Network) SDK — TLB Cell/BOC primitives, Ed25519 wallets, mnemonic, and a typed toncenter client in one composer require.
amashukov/ton-php is a standalone TON SDK for PHP — a single umbrella package that pulls the whole pure-PHP TON stack: TLB Cell / Builder / Slice with a canonical BOC encoder, Ed25519 KeyPair with TON-flavoured mnemonic derivation, a WalletV4R2 contract wrapper with an Address parser, and a typed toncenter v2 JSON-RPC client. Zero blockchain-library dependencies, no Symfony, no native extensions beyond the standard gmp / sodium / bcmath trio. Install it and the full TON wallet + toncenter stack is on your autoloader.
- Canonical BOC — TLB
Cell/Builder/Slicewith a byte-exact bag-of-cells encoder (matches@ton/core). - Ed25519 crypto —
KeyPairsigning/verification plus TON-flavoured PBKDF2Mnemonicderivation (not BIP-39). - Wallet v4r2 —
WalletV4R2contract wrapper,InternalMessagebuilder, and a full TONAddressparser (UQ/EQ, raw, bounceable flags). - Typed toncenter client — toncenter v2 over any PSR-18 transport, with typed value objects instead of raw arrays.
- Composable ports —
ToncenterWalletRpcimplements the wallet'sWalletRpcInterface, so a wallet reads its seqno and broadcasts a signed transfer through toncenter with no glue. - One install — the full TON stack ships through a single
composer require.
olifanton/ton is the best-known PHP TON SDK (~300★), but it ships partial wallet coverage and no canonical bag-of-cells encoder, so cells you serialise may not round-trip byte-for-byte against @ton/core. amashukov/ton-php gives you a byte-exact canonical BOC encoder, a complete WalletV4R2 + Address surface, and a typed toncenter client — the entire stack behind one composer require, each layer separately versioned and individually installable.
composer require amashukov/ton-phpEach layer keeps its own namespace; import what you need:
use Amashukov\TonCell\Builder;
use Amashukov\TonWallet\WalletV4R2;
use Amashukov\Toncenter\ToncenterClient;
use Amashukov\Toncenter\ToncenterWalletRpc;
// Build cells, derive a wallet, broadcast through toncenter — see each
// sub-package README for the full API.The packages compose cleanly: Amashukov\Toncenter\ToncenterWalletRpc implements the Amashukov\TonWallet\WalletRpcInterface port, so a wallet can read its seqno and broadcast a signed transfer through toncenter with no glue.
- PHP 8.3+
ext-gmp(bigint cell / address math)ext-sodium(Ed25519)ext-bcmath- A PSR-18 HTTP client + PSR-17 factories for the toncenter client (e.g.
amashukov/http-client-php+nyholm/psr7)
| Package | Layer |
|---|---|
| amashukov/ton-cell-php | TLB Cell / Builder / Slice + canonical BOC encoder |
| amashukov/ton-crypto-php | Ed25519 KeyPair + TON-flavoured PBKDF2 Mnemonic |
| amashukov/ton-wallet-php | WalletV4R2 wrapper, InternalMessage builder, Address parser |
| amashukov/toncenter-client-php | Typed toncenter v2 client over any PSR-18 transport |
| amashukov/http-client-php | PSR-18 cURL HTTP client |
| amashukov/eth-php | Sister umbrella SDK for Ethereum / EVM |
| amashukov/blockchain-context-bundle | Symfony 7 bundle wiring the TON + EVM stacks |
- PHPStan level 9 across the whole stack.
- php-cs-fixer with the
@PER-CSruleset. - GitHub Actions CI on every push.
- Parity tests pin the BOC encoder byte-for-byte against
@ton/core.
MIT — see LICENSE. Each bundled package is MIT-licensed in its own repository.