承接 botdigit/cryptogateway 相关项目开发

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

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

botdigit/cryptogateway

Composer 安装命令:

composer require botdigit/cryptogateway

包简介

Open-source all-in-one cryptocurrency payment gateway for Laravel. One Facade, every coin, zero complexity.

README 文档

README

Open-source all-in-one cryptocurrency payment gateway for Laravel.

License: MIT PHP Version Laravel

One Facade. Every Coin. Zero Complexity.

CryptoGateway provides a unified API for all cryptocurrency operations — balances, payments, wallets, transactions — across 20+ blockchains. Install via Composer, run one Artisan command, and you're ready to accept crypto payments.

✨ Features

  • Unified APICryptoGateway::btc()->getBalance($address) — same API for every coin
  • 8 Coins Built-in — BTC, ETH, TRX, SOL, LTC, BNB, USDT (ERC-20 & TRC-20), USDC
  • Driver Architecture — Add any coin with 1 class. No core changes.
  • Pre-built Migrations — 5 tables ready to go
  • Security First — AES-256 key encryption, HMAC webhooks, rate limiting, address validation
  • Laravel Native — Events, Artisan commands, Facade, auto-discovery
  • AI-Discoverable — Clean, predictable API that any AI agent can use instantly

📦 Installation

composer require botdigit/cryptogateway
php artisan cryptogateway:install

This publishes the config, runs migrations, and generates a webhook secret.

🚀 Quick Start

Get a Balance

use Botdigit\CryptoGateway\Facades\CryptoGateway;

$balance = CryptoGateway::btc()->getBalance('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa');

echo $balance->confirmed;    // "21000000.00000000"
echo $balance->unconfirmed;  // "0.00000000"
echo $balance->coin;         // "BTC"

Generate an Address

$address = CryptoGateway::eth()->generateAddress('order-123');

echo $address->address;  // "0x..."
echo $address->label;    // "order-123"

Send Crypto

$result = CryptoGateway::eth()->send(
    to: '0x742d35Cc6634C0532925a3b844Bc9e7595f2bD68',
    amount: '0.5',
    options: ['gasLimit' => 21000, 'signedTx' => $signedTransaction]
);

echo $result->txHash;  // "0xabc..."
echo $result->status;  // "broadcast"

Estimate Fees

$fee = CryptoGateway::btc()->estimateFee();

echo $fee->fast;    // "0.00012"
echo $fee->medium;  // "0.00008"
echo $fee->slow;    // "0.00004"

Check All Drivers Health

$health = CryptoGateway::healthCheck();
// ['btc' => true, 'eth' => true, 'trx' => false, ...]

Magic Method Shortcuts

CryptoGateway::btc()->getBalance($addr);   // Bitcoin
CryptoGateway::eth()->getBalance($addr);   // Ethereum
CryptoGateway::trx()->getBalance($addr);   // TRON
CryptoGateway::sol()->getBalance($addr);   // Solana
CryptoGateway::ltc()->getBalance($addr);   // Litecoin
CryptoGateway::bnb()->getBalance($addr);   // BNB (BSC)

Token Support

// USDT on TRON
$balance = CryptoGateway::driver('usdt-trc20')->getBalance($address);

// USDC on Ethereum
$balance = CryptoGateway::driver('usdc-erc20')->getBalance($address);

⚙️ Configuration

Publish the config file:

php artisan vendor:publish --tag=cryptogateway-config

Add your RPC credentials to .env:

CRYPTO_NETWORK=testnet
CRYPTO_DEFAULT_DRIVER=btc

# Bitcoin
BTC_RPC_HOST=http://127.0.0.1:8332
BTC_RPC_USER=bitcoin
BTC_RPC_PASS=your_password

# Ethereum (Infura, Alchemy, etc.)
ETH_RPC_URL=https://mainnet.infura.io/v3/YOUR_KEY
ETH_CHAIN_ID=1

# TRON
TRX_API_URL=https://api.trongrid.io
TRX_API_KEY=your_trongrid_key

# Solana
SOL_RPC_URL=https://api.mainnet-beta.solana.com

# Webhook Security
CRYPTO_WEBHOOK_SECRET=your_64_char_secret

📡 Events

Listen for blockchain events in your Laravel app:

// In EventServiceProvider
protected $listen = [
    \Botdigit\CryptoGateway\Events\TransactionReceived::class => [
        \App\Listeners\HandleNewPayment::class,
    ],
    \Botdigit\CryptoGateway\Events\TransactionConfirmed::class => [
        \App\Listeners\ProcessConfirmedPayment::class,
    ],
];

Available events:

  • TransactionReceived — New incoming transaction detected
  • TransactionConfirmed — Transaction reached required confirmations
  • TransactionFailed — Transaction failed/rejected
  • WebhookReceived — Webhook notification received
  • BalanceChanged — Wallet balance changed

🔧 Artisan Commands

Command Description
cryptogateway:install Install package (config, migrations, webhook secret)
cryptogateway:health Check connectivity to all nodes/APIs
cryptogateway:balances --coin=btc --address=... Check balances
cryptogateway:sync Sync transactions from blockchain
cryptogateway:add-coin Interactive wizard to add a new coin

🔌 Custom Drivers

Add support for any coin with a single class:

// app/CryptoDrivers/DogecoinDriver.php

namespace App\CryptoDrivers;

use Botdigit\CryptoGateway\Drivers\AbstractDriver;

class DogecoinDriver extends AbstractDriver
{
    public function getCoinSymbol(): string { return 'DOGE'; }
    public function getDecimals(): int { return 8; }

    public function getBalance(string $address): BalanceResult
    {
        // Your implementation here
    }

    // ... implement remaining DriverInterface methods
}

Register in config:

// config/cryptogateway.php → drivers
'doge' => [
    'driver' => \App\CryptoDrivers\DogecoinDriver::class,
    'api_key' => env('DOGE_API_KEY'),
],

Or register at runtime:

CryptoGateway::extend('doge', function ($app, $config) {
    return new DogecoinDriver($config);
});

🔒 Security

  • Key Encryption — Private keys encrypted with AES-256-CBC before storage
  • HMAC Webhooks — SHA-256 signature verification on all webhook endpoints
  • Rate Limiting — Configurable per-minute request limits
  • Address Validation — Format validation for 10+ coins before any operation
  • No Key ExposuretoArray() never includes private keys

🗄️ Database

Pre-built migrations create 5 tables:

Table Purpose
crypto_wallets Managed wallets with encrypted keys
crypto_transactions Transaction history and confirmation tracking
crypto_addresses Generated receiving addresses
crypto_webhooks Webhook audit log
crypto_gateway_configs Admin-managed per-coin settings

🧪 Testing

composer test
# or
./vendor/bin/phpunit

📄 License

MIT License. See LICENSE for details.

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Built with ❤️ by Botdigit

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固