harryqt/trongrid-php-sdk

There is no license information available for the latest version (dev-main) of this package.

Trongrid api php sdk library

dev-main 2024-08-17 21:48 UTC

This package is not auto-updated.

Last update: 2025-03-30 22:30:17 UTC


README

Trongrid PHP SDK built using Saloon.

Install

composer require harryqt/trongrid-php-sdk

Usage

use Harryqt\Trongrid\Connector;
use Harryqt\Trongrid\Requests\GetContractTransactionInfoByAccountAddressRequest;

$connector = new Connector('token');
$response = $connector->send(new GetContractTransactionInfoByAccountAddressRequest);

dd($response->body());

Hyperf

Use HyperfConnector for coroutineization of the HTTP client when using on Hyperf framework.

use GuzzleHttp\HandlerStack;
use Hyperf\Guzzle\CoroutineHandler;
use Harryqt\Trongrid\Connector;
use Saloon\Http\Senders\GuzzleSender;

class HyperfConnector extends Connector
{
    public function __construct(public readonly string $token)
    {
        /** @var GuzzleSender $sender */
        $sender = $this->sender();
        $sender->setHandlerStack(HandlerStack::create(new CoroutineHandler()));
    }
}