定制 stingbo/easyblockchain 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

stingbo/easyblockchain

最新稳定版本:1.2.1

Composer 安装命令:

composer require stingbo/easyblockchain

包简介

easy use blockchain api sdk

README 文档

README

Requirement

  1. PHP >= 7.4
  2. Composer

Installation

$ composer require "stingbo/easyblockchain" -vvv

Usage

Tron

🚀 Quick Start
<?php

use EasyBlockchain\Factory;

$config = [
    'tron' => [
        'response_type' => 'array',
        'base_uri' => 'http://127.0.0.1:8090',
        'app_key' => 'YOUR TRON API KEY',
        'app_key_uri' => 'https://api.trongrid.io',
        'log' => [
            'default' => 'dev', // 默认使用的 channel,生产环境可以改为下面的 prod
            'channels' => [
                'dev' => [ // 测试环境
                    'driver' => 'daily',
                    'path' => '/tmp/tron.log',
                    'level' => 'debug',
                    'days' => 60,
                ],
                'prod' => [ // 生产环境
                    'driver' => 'daily',
                    'path' => '/tmp/tron.log',
                    'level' => 'debug',
                    'days' => 90,
                ],
            ],
        ],
    ],
];

// 调用通用API
$app = Factory::tron($config['tron']);
$app->client->get('/wallet/generateaddress');

// 调用Trongrid API,有APIKEY标识,则会自动在header里带上此参数,并调用app_key_uri的地址
$block_number = 88888;
$data = $app->client->get("/v1/blocks/{$block_number}/events", [
    'only_confirmed' => $params['only_confirmed'] ?? true,
    'limit' => $params['limit'] ?? 100,
    'fingerprint' => $params['fingerprint'] ?? '',
], 'APIKEY');

ETH

🚀 Quick Start
<?php

use EasyBlockchain\Factory;

$config = [
    'eth' => [
        'response_type' => 'array',
        'base_uri' => 'http://127.0.0.1:8545',
        'log' => [
            'default' => 'dev', // 默认使用的 channel,生产环境可以改为下面的 prod
            'channels' => [
                'dev' => [ // 测试环境
                    'driver' => 'daily',
                    'path' => '/tmp/eth.log',
                    'level' => 'debug',
                    'days' => 60,
                ],
                'prod' => [ // 生产环境
                    'driver' => 'daily',
                    'path' => '/tmp/eth.log',
                    'level' => 'debug',
                    'days' => 90,
                ],
            ],
        ],
    ],
];

$app = Factory::eth($config['eth']);
$result = $app->client->postJson('', [
    'jsonrpc' => '2.0',
    'method' => 'eth_accounts',
    'params' => [],
    'id' => 1,
]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固