PHPackages                             sandermuller/laravel-solana-sdk - 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. [API Development](/categories/api)
4. /
5. sandermuller/laravel-solana-sdk

ActiveLibrary[API Development](/categories/api)

sandermuller/laravel-solana-sdk
===============================

Laravel wrapper for sandermuller/solana-php-sdk — service provider, facades, env-driven config, and artisan commands for Solana RPC.

0.2.0(3w ago)12[1 PRs](https://github.com/SanderMuller/laravel-solana-sdk/pulls)MITPHPPHP ^8.3CI passing

Since May 13Pushed 3w agoCompare

[ Source](https://github.com/SanderMuller/laravel-solana-sdk)[ Packagist](https://packagist.org/packages/sandermuller/laravel-solana-sdk)[ Docs](https://github.com/SanderMuller/laravel-solana-sdk)[ RSS](/packages/sandermuller-laravel-solana-sdk/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (28)Versions (4)Used By (0)

Laravel Solana SDK
==================

[](#laravel-solana-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0ebab43cbaa9cefd229c44f446d1a79fbddd5fb2205b7cb1e94e938841e22e22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616e6465726d756c6c65722f6c61726176656c2d736f6c616e612d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sandermuller/laravel-solana-sdk)[![Tests](https://camo.githubusercontent.com/8e13dde006ab547f8e8e6550fa7391be8492b15f8a8694e65dee1af86fc843c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f53616e6465724d756c6c65722f6c61726176656c2d736f6c616e612d73646b2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/SanderMuller/laravel-solana-sdk/actions/workflows/run-tests.yml)[![PHPStan](https://camo.githubusercontent.com/c1c283c7ef24cd8a8569e52977d8b5c4d79c8f2b71994729f9bce066dc37a323/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f53616e6465724d756c6c65722f6c61726176656c2d736f6c616e612d73646b2f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/SanderMuller/laravel-solana-sdk/actions/workflows/phpstan.yml)[![Total Downloads](https://camo.githubusercontent.com/b20779796dd90e647f1f6a0417a99242423db08bf75c3348e1d9510db2209126/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616e6465726d756c6c65722f6c61726176656c2d736f6c616e612d73646b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sandermuller/laravel-solana-sdk)[![License](https://camo.githubusercontent.com/9ecd8d9f5297587078220ace86d453609bc5b8715332cc6c9551630f138a60ce/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73616e6465726d756c6c65722f6c61726176656c2d736f6c616e612d73646b2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Laravel wrapper around [`sandermuller/solana-php-sdk`](https://github.com/SanderMuller/solana-php-sdk) — service provider, facades, env-driven config, and artisan commands so you can call Solana RPC from a Laravel app without wiring containers yourself.

```
use SanderMuller\LaravelSolanaSdk\Facades\Solana;

$balance   = Solana::getBalance('SomeWalletAddressBase58'); // lamports as float
$blockhash = Solana::latestBlockhash();                     // typed BlockhashInfo
$status    = Solana::sendAndConfirmTransaction($tx, [$payer]);
```

Contents
--------

[](#contents)

- [Requirements](#requirements)
- [Install](#install)
- [Configuration](#configuration)
- [Facades](#facades)
- [Multi-endpoint transport](#multi-endpoint-transport)
- [Confirming transactions on the queue](#confirming-transactions-on-the-queue)
- [PubSub / WebSocket](#pubsub--websocket)
- [Artisan commands](#artisan-commands)
- [Testing](#testing)
- [Upgrading](#upgrading)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security](#security)
- [Credits](#credits)
- [License](#license)

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

[](#requirements)

- PHP `^8.3`
- Laravel `^11.0 || ^12.0 || ^13.0`
- `ext-sodium` (transitively required by the core SDK)

Install
-------

[](#install)

```
composer require sandermuller/laravel-solana-sdk
```

The service provider auto-discovers. Publish the config if you want to customise defaults:

```
php artisan vendor:publish --tag=solana-sdk-config
```

Configuration
-------------

[](#configuration)

`config/solana-sdk.php` exposes four knobs:

```
return [
    'network'          => env('SOLANA_NETWORK', 'mainnet'),
    'token_program_id' => env('SOLANA_TOKEN_PROGRAM_ID', 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'),
    'transport' => [
        'mode'    => env('SOLANA_TRANSPORT_MODE', 'fallback'),
        'urls'    => array_values(array_filter([
            env('SOLANA_RPC_URL'),
            env('SOLANA_RPC_URL_FALLBACK'),
        ])),
        'headers' => [],
        'timeout' => (float) env('SOLANA_RPC_TIMEOUT', 30.0),
        'retry'   => [
            'max_attempts'  => (int) env('SOLANA_RPC_RETRY_ATTEMPTS', 3),
            'base_delay_ms' => (int) env('SOLANA_RPC_RETRY_BASE_MS', 100),
            'max_delay_ms'  => (int) env('SOLANA_RPC_RETRY_MAX_MS', 2_000),
        ],
    ],
    'commands' => [
        'enabled' => env('SOLANA_COMMANDS_ENABLED', true),
    ],
];
```

`SOLANA_NETWORK` accepts `mainnet`, `mainnet-beta`, `testnet`, `devnet`(also `main`, `test`, `dev`). The RPC endpoint is derived from the `Network` enum in the core SDK.

Facades
-------

[](#facades)

```
use SanderMuller\LaravelSolanaSdk\Facades\Solana;
use SanderMuller\LaravelSolanaSdk\Facades\SolanaRpc;

$balance   = Solana::getBalance('SomeWalletAddressBase58');
$info      = Solana::accountInfo('SomeWalletAddressBase58'); // typed AccountInfo
$blockhash = Solana::latestBlockhash();                      // typed BlockhashInfo

// Send + poll until confirmed in a single call:
$status = Solana::sendAndConfirmTransaction($tx, [$payer]);

// Low-level JSON-RPC escape hatch
$result = SolanaRpc::call('getSlot');
```

`Solana` proxies the typed `Connection` API (~60 RPC methods covering ~80 % of the Solana JSON-RPC spec — accounts, blocks, slots, signatures, tokens, supply, stake, vote, inflation). `SolanaRpc` proxies the raw `SolanaRpcClient` for calls the typed facade does not yet cover.

Both bindings are also reachable via plain DI:

```
use SanderMuller\SolanaPhpSdk\Connection;

class WalletController
{
    public function show(Connection $solana, string $address): array
    {
        return ['balance' => $solana->getBalance($address)];
    }
}
```

### Programs, builders, signers

[](#programs-builders-signers)

The core SDK ships first-class program builders (`SystemProgram`, `SplTokenProgram`, `Token2022Program`, `MemoProgram`, `StakeProgram`, `VoteProgram`, `AddressLookupTableProgram`, `ComputeBudgetProgram`, `MetaplexProgram`, `AnchorIdl`, …), a sanitize-safe `TransactionBuilder`, a `Util\PriorityFee` helper, and a `Contracts\MessageSigner` interface (with `Signing\InMemoryMessageSigner`as the local adapter). Use them directly — no wrapping required:

```
use SanderMuller\SolanaPhpSdk\TransactionBuilder;
use SanderMuller\SolanaPhpSdk\Programs\SystemProgram;
use SanderMuller\LaravelSolanaSdk\Facades\Solana;

$blockhash = Solana::latestBlockhash();

$tx = TransactionBuilder::make()
    ->feePayer($payer->publicKey)
    ->recentBlockhash($blockhash)
    ->addInstruction(SystemProgram::transfer($payer->publicKey, $to, $lamports))
    ->addSigner($payer)
    ->build();

$status = Solana::sendAndConfirmTransaction($tx, [$payer]);
```

Multi-endpoint transport
------------------------

[](#multi-endpoint-transport)

Set `SOLANA_RPC_URL` (and optionally `SOLANA_RPC_URL_FALLBACK`) to route through your own RPC provider with automatic retry + fallback. Leave both unset to keep the public-endpoint default.

```
SOLANA_RPC_URL=https://mainnet.helius-rpc.com/?api-key=…
SOLANA_RPC_URL_FALLBACK=https://api.mainnet-beta.solana.com
SOLANA_TRANSPORT_MODE=fallback        # or round_robin
SOLANA_RPC_TIMEOUT=30
SOLANA_RPC_RETRY_ATTEMPTS=3
```

For more elaborate setups (custom auth headers, multiple fallbacks) publish the config and edit `transport` directly — the wrapper hands the array straight to `SanderMuller\SolanaPhpSdk\Rpc\TransportFactory`.

Confirming transactions on the queue
------------------------------------

[](#confirming-transactions-on-the-queue)

This wrapper ships `SanderMuller\LaravelSolanaSdk\Queue\ConfirmTransactionJob`out of the box. Dispatch it after `sendTransaction` so the long-tail confirmation phase becomes a background job that fires `TransactionConfirmed` / `TransactionExpired` events (the event classes live in the SDK):

```
use SanderMuller\LaravelSolanaSdk\Facades\Solana;
use SanderMuller\LaravelSolanaSdk\Queue\ConfirmTransactionJob;

$blockhash = Solana::latestBlockhash();
$signature = Solana::sendTransaction($tx, [$payer]);

ConfirmTransactionJob::dispatch(
    signature: $signature,
    lastValidBlockHeight: $blockhash->lastValidBlockHeight,
    context: ['order_id' => $order->id],
);
```

Listen for `SanderMuller\SolanaPhpSdk\Events\TransactionConfirmed` and `SanderMuller\SolanaPhpSdk\Events\TransactionExpired` in `EventServiceProvider`(events are SDK-side; only the Job moved to this wrapper).

PubSub / WebSocket
------------------

[](#pubsub--websocket)

`SolanaPubSubClient` is bound transient against the configured network, so you can typehint it directly:

```
use SanderMuller\SolanaPhpSdk\Services\SolanaPubSubClient;

class WatchSignatures
{
    public function handle(SolanaPubSubClient $pubsub, string $signature): void
    {
        $pubsub->enableAutoReconnect();
        $pubsub->signatureSubscribe($signature);

        foreach ($pubsub->listen() as $event) {
            // …
        }
    }
}
```

Artisan commands
----------------

[](#artisan-commands)

CommandPurpose`solana:balance {address}`Print SOL balance + lamports`solana:airdrop {address} {sol=1}`Request devnet/testnet airdrop`solana:account {address}`Dump raw account info JSON`solana:tx {signature}`Look up a transaction by signature`solana:health`RPC health + version`solana:tokens {owner}`List SPL token accounts owned by an address`solana:fees {addresses?*}`Recent prioritization fee samplesDisable all bundled commands with `SOLANA_COMMANDS_ENABLED=false` (they hit live RPC; production may want them off).

Testing
-------

[](#testing)

```
composer test
```

### Stubbing RPC in tests

[](#stubbing-rpc-in-tests)

Call `Solana::fake()` to swap the bound `SolanaRpcClient` for the core SDK's `InMemoryRpcStub` so the SDK never hits the network:

```
use SanderMuller\LaravelSolanaSdk\Facades\Solana;

it('reads the balance', function (): void {
    Solana::fake()->script([
        'getBalance' => ['value' => 5_000_000],
    ]);

    expect(Solana::getBalance($address))->toBe(5_000_000.0);
    expect(Solana::fakedStub()?->methodCalls())->toContain('getBalance');
});
```

Wire the core Pest expectations (`toBeConfirmed`, `toHaveCustomCode`, `toBeInstructionError`) once from `tests/Pest.php`:

```
use SanderMuller\SolanaPhpSdk\Testing\PestExpectations;

PestExpectations::register();
```

The wrapper's own test suite runs against Orchestra Testbench with the package provider auto-registered. Network-dependent tests are not shipped — facade unit tests just verify resolution + container shape.

Upgrading
---------

[](#upgrading)

See [UPGRADING.md](UPGRADING.md).

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md). Updated automatically on release publish.

Contributing
------------

[](#contributing)

PRs welcome. Run the local gauntlet before opening one:

```
vendor/bin/pest          # tests
vendor/bin/pint --test   # style
vendor/bin/phpstan       # static analysis
vendor/bin/rector --dry-run
```

The package is intentionally a **thin** wrapper — net-new RPC methods, program builders, and DTOs belong in [`sandermuller/solana-php-sdk`](https://github.com/SanderMuller/solana-php-sdk). The wrapper only adds Laravel glue (`@method` lines on the `Solana` facade, env-driven config keys, container bindings, `solana:*` commands). See [`CLAUDE.md`](CLAUDE.md) for the full scope rules.

Security
--------

[](#security)

See [SECURITY.md](SECURITY.md).

Credits
-------

[](#credits)

- [Sander Muller](https://github.com/SanderMuller)
- Wraps [`sandermuller/solana-php-sdk`](https://github.com/SanderMuller/solana-php-sdk)

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE).

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance95

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity40

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 ~4 days

Total

2

Last Release

23d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/abeb7bd51fd77656b4133bdcdf4eca99cc8b495b83ca72f63674ff15f2b72a39?d=identicon)[SanderMuller](/maintainers/SanderMuller)

---

Top Contributors

[![SanderMuller](https://avatars.githubusercontent.com/u/9074391?v=4)](https://github.com/SanderMuller "SanderMuller (16 commits)")

---

Tags

laravelsdkpackagerpcfacadeblockchainsolana

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sandermuller-laravel-solana-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/sandermuller-laravel-solana-sdk/health.svg)](https://phpackages.com/packages/sandermuller-laravel-solana-sdk)
```

###  Alternatives

[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.4k51.0M7.4k](/packages/larastan-larastan)[laravel/ai

The official AI SDK for Laravel.

9782.1M153](/packages/laravel-ai)[laravel/sail

Docker files for running a basic Laravel application.

1.9k199.2M1.2k](/packages/laravel-sail)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

76318.2M110](/packages/laravel-mcp)[spatie/laravel-health

Monitor the health of a Laravel application

88011.3M149](/packages/spatie-laravel-health)[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)

PHPackages © 2026

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