1. Go to this page and download the library: Download amashukov/ton-cell-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amashukov / ton-cell-php example snippets
use Amashukov\TonCell\AddressData;
use Amashukov\TonCell\Builder;
$cell = (new Builder())
->storeUint(0xF8A7EA5, 32) // jetton-transfer op
->storeUint(0xC0FFEE, 64) // query id
->storeCoins('1000000') // amount (decimal string for bigints)
->storeAddress(new AddressData(0, $hashPart32)) // destination
->endCell();
$slice = $cell->beginParse();
$op = $slice->loadUint(32); // int when fitting, string for >PHP_INT_MAX
$queryId = $slice->loadUint(64);
$amount = $slice->loadCoins(); // always decimal string
$dest = $slice->loadAddress(); // AddressData|null
$hash = $cell->hash(); // 32-byte SHA-256 of the recursive TLB representation
$depth = $cell->maxDepth();
use Amashukov\TonCell\Boc;
$wireBytes = Boc::encode($cell); // canonical TON BOC bytes with CRC32C tail
$base64 = Boc::encodeBase64($cell); // ready for toncenter /sendBoc
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.