Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Ton Cell Php

Ton Cell Php Laravel Package

amashukov/ton-cell-php

View on GitHub
Deep Wiki
Context7

TON TLB primitives in pure PHP — Cell/Builder/Slice + canonical BOC encoder, byte-for-byte parity with @ton/core.

Frequently asked questions about Ton Cell Php
Can I use this package to replace Node.js-based TON interactions (e.g., @ton/core) in Laravel?
This package provides a pure-PHP alternative for TON’s cell layer, so you can build/parse TLB-encoded data (e.g., Jetton transfers, contract messages) directly in Laravel without Node.js. However, for full TON SDK functionality (e.g., RPC calls, wallet signing), you’ll still need to pair it with other tools like `amashukov/ton-wallet-php` or Node.js for specific tasks.
What Laravel versions does this package support?
The package requires PHP 8.1+ and is framework-agnostic, but it integrates seamlessly with Laravel 9/10/11. No Laravel-specific dependencies exist, so it works as long as your PHP version matches the package’s requirements (check `composer.json`).
How do I install and configure this in Laravel?
Run `composer require amashukov/ton-cell-php`, then register the package in `config/app.php` under `providers`. For dependency injection, bind the `Builder`, `Slice`, and `Boc` classes in a service provider. No additional configuration is needed for basic usage.
Does this package support big integers (e.g., for large TON amounts)?
Yes, but it requires the `ext-gmp` PHP extension for handling values exceeding `PHP_INT_MAX`. If `ext-gmp` isn’t available, you’ll encounter errors. Fallback options like `bcmath` may work for some cases, but full parity with `@ton/core` depends on `ext-gmp`.
How can I verify the BOC output matches @ton/core’s canonical format?
The package guarantees byte-for-byte parity with `@ton/core` v15. Test by comparing BOC outputs (e.g., a Jetton transfer cell) using a hex dump or TON tools like `toncli`. The `Boc::encode()` method enforces the same CRC32C and offset_byte_size rules as the TypeScript SDK.
Is this package suitable for production Laravel apps processing TON messages?
While the package is production-ready for basic cell operations, its low adoption (few stars/dependents) suggests unproven reliability in high-stakes environments. Benchmark performance against `@ton/core` and write integration tests with real TON contracts before deploying.
Can I use this to parse incoming TON messages (e.g., Jetton transfers) in Laravel?
Yes. Use the `Slice` class to parse raw TLB data from incoming messages (e.g., via a webhook or TON API). The fluent API mirrors the `Builder`, making it easy to extract fields like sender addresses, amounts, or payloads. Pair it with Laravel’s request handling for seamless integration.
Are there performance concerns compared to Node.js (@ton/core)?
PHP may be slower than TypeScript for heavy TON operations (e.g., batch processing). If low latency is critical, consider hybrid approaches: use this package for Laravel logic and offload intensive tasks to a Node.js microservice. Profile with real-world workloads to assess trade-offs.
What alternatives exist for TON cell handling in PHP?
Alternatives include shelling out to `toncli` or `@ton/core` via Node.js, or reinventing the cell layer yourself. This package is the only pure-PHP solution with byte-exact `@ton/core` parity, but it lacks higher-level features (e.g., wallet signing). For full TON SDK support, Node.js remains the standard.
How can I extend this for Laravel-specific workflows (e.g., queue jobs for TON messages)?
Wrap the package in a Laravel service class (e.g., `TonCellService`) and bind it to the container. Use Laravel’s queue system to process deferred TON messages (e.g., parsing `Slice` objects in a job). For caching, memoize cell hashes or BOCs in Redis or the database to avoid redundant computations.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor