blockchain service integration for atom php framework
mani-systems/atom-crypto-wallet is a Laravel package for blockchain service integration for atom php framework.
It currently has 0 GitHub stars and 1 downloads on Packagist.
Install it with composer require mani-systems/atom-crypto-wallet.
Discover more Laravel packages by mani-systems
or browse all Laravel packages to compare alternatives.
Last updated
Laravel Crypto Wallet is a flexible Laravel package that provides a unified factory class for interacting with various crypto wallet drivers. Currently, it supports Bitgo, with plans to add more drivers and introduce a unified facade in future releases.
Our Future Plan:
Enhance Bitgo support, add more drivers, unify the Wallet facade, offer driver selection via configuration—and still let you work directly with each driver.
Note: The unified facade is not yet available, but it will be introduced in a future release
Currently, we support Bitgo for operations such as:
The package uses a clear, fluent API and is fully testable, making it simpler to integrate cryptocurrency-related features into your Laravel application.
composer require manisystems/laravel-crypto-wallet
To run Bitgo Express locally using Docker, you can use the following commands:
docker pull bitgo/express:latest
docker run -it -p 3080:3080 bitgo/express:latest
For more information on Bitgo Express Docker, refer to the official Bitgo Express Docker documentation.
By default, the configuration for the Bitgo driver is included under the drivers.bitgo key. Once published, you’ll find the config at config/cryptowallet.php. Below is an example of what the Bitgo config might look like:
return [
'drivers' => [
'bitgo' => [
'use_mocks' => env('BITGO_USE_MOCKS', false),
'testnet' => env('BITGO_TESTNET', true),
'api_key' => env('BITGO_API_KEY'),
'express_api_url' => env('BITGO_EXPRESS_API_URL'),
'default_coin' => env('BITGO_DEFAULT_COIN', 'tbtc4'),//This is not a typo or just a result of a lazy developer :). BitGo is moving to Testnet4, so the Bitcoin testnet is now TBTC4.
'webhook_callback_url' => env('BITGO_WEBHOOK_CALLBACK'),
],
],
];
.env Example:
BITGO_USE_MOCKS = false
BITGO_TESTNET = true
BITGO_API_KEY = YOUR-BITGO-API-KEY
BITGO_EXPRESS_API_URL = http://localhost:3080/api/v2/
BITGO_DEFAULT_COIN = tbtc4
BITGO_WEBHOOK_CALLBACK = https://yourapp.com/webhook/bitgo
Adjust these environment variables according to your needs.
All Bitgo functionality is encapsulated within the Bitgo driver, which is used by default when calling WalletManager::bitgo().
The core entry point for all wallet-related activities is the WalletManager class. You can call static methods (like bitgo()) to instantiate a specific driver. For example:
use ManiSystems\CryptoWallet\WalletManager;
$wallet = WalletManager::bitgo();
Optionally, you can specify a coin and/or wallet ID:
$wallet = WalletManager::bitgo(coin: 'tbtc', walletId: 'my-wallet-id');
$wallet = WalletManager::bitgo(coin: 'tbtc')
->generate(
label: 'Test Wallet',
passphrase: 'test-passphrase',
enterpriseId: 'enterprise-id',
);
$wallet = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
->get();
$wallets = WalletManager::bitgo()->listAll();
$address = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
->generateAddress(label: 'My Address');
$transfers = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
->getTransfers();
Send to multiple recipients:
use ManiSystems\CryptoWallet\Drivers\Bitgo\Data\SendTransferToMany\SendToManyRequest;
use ManiSystems\CryptoWallet\Drivers\Bitgo\Data\SendTransferToMany\Recipient;
$sendTransferData = new SendToManyRequest(
recipients: [
new Recipient(address: 'tb1psv9q9zlp94s9jncnlye4kj0acyp56suxf28hn4k34vyrmsrp4qtsc9eqlq', amount: 4368),
],
walletPassphrase: 'test',
feeRate: 250,
);
$response = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
->sendTransferToMany(sendToManyRequest: $sendTransferData);
$maxSpendable = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
->getMaximumSpendable([
'feeRate' => 0,
]);
$result = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')->consolidate([
'walletPassphrase' => 'testing-pass',
'bulk' => true,
'minValue' => '0',
'minHeight' => 0,
'minConfirms' => 0,
]);
When you generate a wallet, you can easily attach a webhook:
$webhook = WalletManager::bitgo('tbtc')
->generate(
label: 'wallet with webhook',
passphrase: 'test-passphrase',
enterpriseId: 'enterprise-id'
)
->addWebhook(
numConfirmations: 6,
callbackUrl: 'https://yourapp.com/webhook/bitgo'
);
You can easily fetch current exchange rates using the ExchangeRateManager.
Currently, we provide a Bitgo driver implementation.
use ManiSystems\CryptoWallet\ExchangeRateManager;
$rates = ExchangeRateManager::bitgo()->all();
use ManiSystems\CryptoWallet\ExchangeRateManager;
$tbtcRates = ExchangeRateManager::bitgo()->getByCoin('tbtc');
We use Pest PHP to ensure all functionalities work as expected. You can find our test files under tests/. To run the tests:
./vendor/bin/pest
# or
php artisan test
git checkout -b feature/someFeature)git commit -m 'feat: Add some feature')git push origin feature/someFeature)We welcome all contributions that help improve this package!