A simple, early version RPC and API PHP SDK for Solana blockchain under MIT licence
Installation
You can install the package via composer: or github
Usage
Using the Solana simple client
You can use the Connection class for convenient access to API methods. Some are defined in the code:
use Tighten\SolanaPhpSdk\Connection;
use Tighten\SolanaPhpSdk\SolanaRpcClient;
// Using a defined method
$sdk = new Connection(new SolanaRpcClient(SolanaRpcClient::MAINNET_ENDPOINT));
$accountInfo = $sdk->getAccountInfo('4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA');
var_dump($accountInfo);
For all the possible methods, see the API documentation.
Directly using the RPC client
The Connection class is just a light convenience layer on top of the RPC client. You can, if you want, use the client directly, which allows you to work with the full Response object:
use Tighten\SolanaPhpSdk\SolanaRpcClient;
$client = new SolanaRpcClient(SolanaRpcClient::MAINNET_ENDPOINT);
$accountInfoResponse = $client->call('getAccountInfo', ['4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA']);
$accountInfoBody = $accountInfoResponse->json();
$accountInfoStatusCode = $accountInfoResponse->getStatusCode();
Transactions
Here is working example of sending a transfer instruction to the Solana blockchain:
$client = new SolanaRpcClient(SolanaRpcClient::DEVNET_ENDPOINT);
$connection = new Connection($client);
$fromPublicKey = KeyPair::fromSecretKey([...]);
$toPublicKey = new PublicKey('J3dxNj7nDRRqRRXuEMynDG57DkZK4jYRuv3Garmb1i99');
$instruction = SystemProgram::transfer(
$fromPublicKey->getPublicKey(),
$toPublicKey,
6
);
$transaction = new Transaction(null, null, $fromPublicKey->getPublicKey());
$transaction->add($instruction);
$txHash = $connection->sendTransaction($transaction, $fromPublicKey);
Note: This project is in alpha, the code to generate instructions is still being worked on $instruction = SystemProgram::abc()
Roadmap
- Borsh serialize and deserialize.
- Improved documentation.
- Build out more of the Connection, SystemProgram, TokenProgram, MetaplexProgram classes.
- Improve abstractions around working with binary data.
- Optimizations:
- Leverage PHP more.
- Better cache
$recentBlockhashwhen sending transactions.
- Suggestions? Open an issue or PR 😀
Testing
composer test
License
The MIT License (MIT). Please see License File for more information.







oral finasteride
oral finasteride
lisinopril 5 mg
lisinopril 5 mg
cefixime
cefixime
remeron 15 mg oral tablet
remeron 15 mg oral tablet
lasix medicine price
lasix medicine price
fluconazole 200 mg oral tablet
fluconazole 200 mg oral tablet
lasix furosemide tablets
lasix furosemide tablets