PHPackages                             amashukov/blockchain-context-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. amashukov/blockchain-context-bundle

ActiveSymfony-bundle[Security](/categories/security)

amashukov/blockchain-context-bundle
===================================

Symfony 7 bundle wiring the pure-PHP TON + EVM SDKs (amashukov/ton-php + amashukov/eth-php) into an application — autowired signature verification (EIP-191 + Ed25519/TonConnect), AES-256-GCM private-key encryption, and an HD deposit-wallet deriver port.

v0.5.2(1w ago)00MITPHPPHP &gt;=8.3CI passing

Since May 24Pushed 1w agoCompare

[ Source](https://github.com/AndreyMashukov/blockchain-context-bundle)[ Packagist](https://packagist.org/packages/amashukov/blockchain-context-bundle)[ Docs](https://github.com/AndreyMashukov/blockchain-context-bundle)[ RSS](/packages/amashukov-blockchain-context-bundle/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (36)Versions (10)Used By (0)

amashukov/blockchain-context-bundle
===================================

[](#amashukovblockchain-context-bundle)

Symfony 7 bundle for crypto payments — autowires the pure-PHP TON + EVM SDKs into typed RPC clients, signature verification, key encryption, and per-chain finality / detection / gas / tx-builder services.

[![CI](https://camo.githubusercontent.com/c93db2a8a09fcb484e2453eb7c9941371a7aab9bfb900c1af5dba7dcca426b92/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f626c6f636b636861696e2d636f6e746578742d62756e646c652f63692e796d6c3f6272616e63683d6d61696e266c6162656c3d4349)](https://github.com/AndreyMashukov/blockchain-context-bundle/actions)[![PHPStan L9](https://camo.githubusercontent.com/4b22e9f769af410ce2f6d5239d94a1d57233c858bafe169b0262e09ce271baef/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f416e647265794d617368756b6f762f626c6f636b636861696e2d636f6e746578742d62756e646c652f7374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d5048505374616e2532304c39)](https://github.com/AndreyMashukov/blockchain-context-bundle/actions)[![Latest Version](https://camo.githubusercontent.com/7f98691e6d61fb72bad91177fc14da722efdf483f2af430cc2f0d5110e2cf2de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616d617368756b6f762f626c6f636b636861696e2d636f6e746578742d62756e646c65)](https://packagist.org/packages/amashukov/blockchain-context-bundle)[![Downloads](https://camo.githubusercontent.com/e962f7f18f1ef34e8b7a42e7bc1349806fb57978c6015619a9f460aefbf57f2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616d617368756b6f762f626c6f636b636861696e2d636f6e746578742d62756e646c65)](https://packagist.org/packages/amashukov/blockchain-context-bundle)[![PHP](https://camo.githubusercontent.com/b2f08606f4ecfaf8b7bbb93dd55f8e70baaad85f6eb4c93f272e2605ce362693/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f616d617368756b6f762f626c6f636b636861696e2d636f6e746578742d62756e646c652f706870)](https://packagist.org/packages/amashukov/blockchain-context-bundle)[![License](https://camo.githubusercontent.com/54f646847e873f54142af73200ec3832f320ef5520c32e161c8665238d52908f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f616d617368756b6f762f626c6f636b636861696e2d636f6e746578742d62756e646c65)](LICENSE)[![Stars](https://camo.githubusercontent.com/11aab906c79a37d2d9a3974a4e1a3547cf9a04ca03600ed8608c0a922bdf7898/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f416e647265794d617368756b6f762f626c6f636b636861696e2d636f6e746578742d62756e646c653f7374796c653d736f6369616c)](https://github.com/AndreyMashukov/blockchain-context-bundle)

`amashukov/blockchain-context-bundle` is a **Symfony 7 bundle for crypto payments** that turns the pure-PHP TON + EVM SDKs ([`amashukov/ton-php`](https://github.com/AndreyMashukov/ton-php) + [`amashukov/eth-php`](https://github.com/AndreyMashukov/eth-php)) into a ready, autowired blockchain surface for your application — typed JSON-RPC clients, deposit-detection / finality / gas / deposit-tx-builder services, EIP-191 + TON Connect signature verification, and AES-256-GCM private-key encryption — all configured from one place, env-agnostic, with full DI autowiring.

Features
--------

[](#features)

- **Autowired RPC clients** — `Amashukov\EthRpc\JsonRpcProvider` / `EthRpcClient` (ethers.js-style EVM JSON-RPC) and `Amashukov\Toncenter\ToncenterClient` (typed toncenter v2), wired over a PSR-18 transport (`amashukov/http-client-php` cURL client; toncenter gets an `X-Api-Key` + `429/5xx/542`-retry middleware pipeline).
- **Signing &amp; wallet** — `Amashukov\Eip1559TxSigner\Eip1559Signer` (EIP-1559 offline signer) and `Amashukov\TonWallet\WalletV4R2` (built from a mnemonic via the bundle factory); `ToncenterWalletRpc` implements the wallet's RPC port.
- **Per-chain domain services** (host-app-agnostic, owning ports the host implements): `Detection\ChainDepositCheckChain`, `Finality\{ConfirmationCheckChain,ConfirmationCounterRegistry,DepthPollingFinalityVerifier}`, `Gas\{EthGasFetcher,TonGasFetcher,ZeroGasFetcher}`, `TxBuilder\DepositTxBuilderChain` (+ per-chain TON / TON-Jetton / ETH / USDT-ERC20 builders), `Explorer\DefaultExplorerUrl`, `Numeric\{BcDecimal,UuidIntCodec,UsdtJettonDecimals}`, `Time\RealSleeper`.
- **`SignatureVerifier`** — EIP-191 (`personal_sign`, secp256k1 ecrecover + Keccak-256) + Ed25519 (TON Connect) verification.
- **`PrivKeyEncrypter`** — AES-256-GCM authenticated encryption for keys at rest.
- **`DepositWalletDeriverInterface`** port + `DerivedWallet` / `DepositEvidence` value objects.
- **Tagged-iterator chains** — `ChainDepositCheckChain`, `ConfirmationCheckChain`, `ConfirmationCounterRegistry`, and `DepositTxBuilderChain` auto-collect their members via bundle-namespaced tags (`blockchain_context.*`); drop a new impl and it joins the chain with no DI edits.

Why amashukov/blockchain-context-bundle
---------------------------------------

[](#why-amashukovblockchain-context-bundle)

There is no maintained Symfony bundle for crypto-payment infrastructure — most projects glue a raw RPC client into a service by hand. This bundle fills that empty niche: it wires the entire TON + EVM stack into Symfony's container with autowiring, env-agnostic config, and a tagged-iterator extension model, so adding a new chain or deposit builder is a drop-in service, not a DI rewrite.

Installation
------------

[](#installation)

```
composer require amashukov/blockchain-context-bundle
```

Register the bundle (Symfony Flex does this automatically):

```
// config/bundles.php
return [
    // ...
    Amashukov\BlockchainContextBundle\BlockchainContextBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

Inject any autowired service directly:

```
use Amashukov\EthRpc\JsonRpcProviderInterface;
use Amashukov\Toncenter\ToncenterClientInterface;
use Amashukov\BlockchainContextBundle\Service\SignatureVerifier;

final class SomeService
{
    public function __construct(
        private JsonRpcProviderInterface $eth,
        private ToncenterClientInterface $ton,
        private SignatureVerifier $verifier,
    ) {}
}
```

### Configuration

[](#configuration)

The bundle is **env-agnostic**: it exposes a config tree and reads only `%blockchain_context.*%` parameters internally. The host maps them to its own environment (use `%env(...)%`, with `default:` processors as you like). Config is split per chain (`eth:` / `ton:`), each toggleable via `enabled` (default `true` — set `false` for a single-chain deployment):

```
# config/packages/blockchain_context.yaml
blockchain_context:
    eth:
        enabled:            true
        rpc_url:            '%env(ETH_RPC_URL)%'                  # EVM JSON-RPC endpoint
        chain_id:          '%env(int:BRIDGE_ETH_CHAIN_ID)%'
        wallet_private_key:'%env(BRIDGE_ETH_WALLET_PRIVATE_KEY)%'
        usdt_token_address:'%env(USDT_TOKEN_ADDRESS)%'           # USDT-ERC20 deposits
        explorer:          '%env(BRIDGE_ETH_EXPLORER)%'          # default https://etherscan.io
    ton:
        enabled:            true
        toncenter_api_key: '%env(TONCENTER_API_KEY)%'            # optional — lifts toncenter rate limit
        wallet_mnemonic:   '%env(BRIDGE_TON_WALLET_MNEMONIC)%'
        bridge_contract:   '%env(BRIDGE_TON_CONTRACT)%'          # USDT-Jetton deposits
        finality_polls:    '%env(int:TON_FINALITY_POLLS)%'       # 0 = skip depth re-poll
        explorer:          '%env(TON_EXPLORER)%'                 # default https://tonscan.org
    deposit_wallet_encryption_key: '%env(DEPOSIT_WALLET_ENCRYPTION_KEY)%' # base64 of 32 bytes
```

Every key is optional (sensible empty / `0` / explorer defaults), so a host that uses only one chain can leave the other section's values unset (or `enabled: false`).

Requirements
------------

[](#requirements)

- PHP 8.3+
- Symfony 7.x (`symfony/framework-bundle`)
- `ext-gmp`, `ext-sodium`, `ext-openssl`, `ext-bcmath`

Related packages
----------------

[](#related-packages)

PackageLayer[amashukov/ton-php](https://github.com/AndreyMashukov/ton-php)Umbrella TON SDK (Cell/BOC, wallet, toncenter)[amashukov/eth-php](https://github.com/AndreyMashukov/eth-php)Umbrella EVM SDK (Keccak, secp256k1, RLP, EIP-1559, ABI, RPC)[amashukov/http-client-php](https://github.com/AndreyMashukov/http-client-php)PSR-18 cURL HTTP client[amashukov/eth-rpc-client-php](https://github.com/AndreyMashukov/eth-rpc-client-php)ethers.js v6-style JSON-RPC client[amashukov/toncenter-client-php](https://github.com/AndreyMashukov/toncenter-client-php)Typed toncenter v2 clientQuality
-------

[](#quality)

- **PHPStan level 9** across `src/`.
- **php-cs-fixer** with the `@PER-CS` ruleset.
- **GitHub Actions CI** on every push.

```
composer install
composer test     # PHPUnit
composer stan     # PHPStan (level 9)
composer cs       # php-cs-fixer (dry-run)
composer rector   # Rector (dry-run)
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance98

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

9

Last Release

8d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b3e86ca79a82515b23e0239b1d3616c747e59b64c40e169d538d5c759c9bbc4?d=identicon)[Andrey Mashukov](/maintainers/Andrey%20Mashukov)

---

Top Contributors

[![AndreyMashukov](https://avatars.githubusercontent.com/u/24682497?v=4)](https://github.com/AndreyMashukov "AndreyMashukov (17 commits)")

---

Tags

blockchaincrypto-paymentsethereumphpsymfonysymfony-bundletonphpsymfonysignaturejson-rpcSymfony Bundleethereumblockchaintoncrypto paymentsevmtonconnecteip-191

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/amashukov-blockchain-context-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/amashukov-blockchain-context-bundle/health.svg)](https://phpackages.com/packages/amashukov-blockchain-context-bundle)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M195](/packages/sulu-sulu)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

51090.8k2](/packages/web-auth-webauthn-framework)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1715.6k12](/packages/2lenet-crudit-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
