承接 mani-systems/atom-crypto-wallet 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mani-systems/atom-crypto-wallet

Composer 安装命令:

composer require mani-systems/atom-crypto-wallet

包简介

blockchain service integration for atom php framework

README 文档

README

Table of Contents

  1. Introduction
  2. Installation
  3. Configuration
  4. Usage
  5. Testing
  6. Contributing

Introduction

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.

Installation

  1. Install via Composer:
composer require manisystems/laravel-crypto-wallet

Bitgo Express Docker

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.

Configuration

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.

Usage

Bitgo Driver

All Bitgo functionality is encapsulated within the Bitgo driver, which is used by default when calling WalletManager::bitgo().

Wallet Factory

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');

Generating a Wallet

$wallet = WalletManager::bitgo(coin: 'tbtc')
    ->generate(
        label: 'Test Wallet',
        passphrase: 'test-passphrase',
        enterpriseId: 'enterprise-id',
    );

Getting a Wallet

$wallet = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
        ->get();

Listing Wallets

$wallets = WalletManager::bitgo()->listAll();

Generating Addresses

$address = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
    ->generateAddress(label: 'My Address');

Getting Wallet Transfers

$transfers = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
    ->getTransfers();

Sending Transactions

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);

Getting Maximum Spendable

$maxSpendable = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')
    ->getMaximumSpendable([
        'feeRate' => 0,
    ]);

Consolidating Wallet Balances

$result = WalletManager::bitgo(coin: 'tbtc', walletId: 'wallet-id')->consolidate([
    'walletPassphrase' => 'testing-pass',
    'bulk' => true,
    'minValue' => '0',
    'minHeight' => 0,
    'minConfirms' => 0,
]);

Adding Webhooks

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'
    );

Exchange Rates

You can easily fetch current exchange rates using the ExchangeRateManager.

Currently, we provide a Bitgo driver implementation.

Fetch All Exchange Rates

use ManiSystems\CryptoWallet\ExchangeRateManager;

$rates = ExchangeRateManager::bitgo()->all();

Fetch Exchange Rates for a Specific Coin

use ManiSystems\CryptoWallet\ExchangeRateManager;

$tbtcRates = ExchangeRateManager::bitgo()->getByCoin('tbtc');

Testing

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

Contributing

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/someFeature)
  3. Make your changes
  4. Write or update tests
  5. Commit your changes (git commit -m 'feat: Add some feature')
  6. Push to the branch (git push origin feature/someFeature)
  7. Create a Pull Request

We welcome all contributions that help improve this package!

mani-systems/atom-crypto-wallet 适用场景与选型建议

mani-systems/atom-crypto-wallet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「atom」 「crypto」 「laravel」 「wallet」 「bitgo」 「khomeriki」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mani-systems/atom-crypto-wallet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mani-systems/atom-crypto-wallet 我们能提供哪些服务?
定制开发 / 二次开发

基于 mani-systems/atom-crypto-wallet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-26