tesseract/crypto-sdk
Composer 安装命令:
composer require tesseract/crypto-sdk
包简介
Tesseract Crypto SDK PHP from Tesseract Crypto API v2
README 文档
README
How to install Tesseract Crypto SDK PHP
The recommended way to install Tesseract Crypto SDK PHP is through Composer.
# Install Composer curl -sS https://getcomposer.org/installer | php
Next, run the Composer command to install the latest stable version of Guzzle:
php composer.phar require tesseract/crypto-sdk
After installing, you need to require Composer's autoloader:
require 'vendor/autoload.php';
Configuration
<?php return [ /* |-------------------------------------------------------------------------- | Default Base URL |-------------------------------------------------------------------------- */ 'tesseract.crypto.baseUrl' => 'https://sandbox.tesseract.mx', /* |-------------------------------------------------------------------------- | Default Access Key ID |-------------------------------------------------------------------------- */ 'tesseract.crypto.access_key_id' => '[your_access_key_id]', /* |-------------------------------------------------------------------------- | Default Secret Access Key |-------------------------------------------------------------------------- */ 'tesseract.crypto.secret_access_key' => '[your_secret_access_key]', /* |-------------------------------------------------------------------------- | Default Debug |-------------------------------------------------------------------------- */ 'tesseract.crypto.debug' => false, /* |-------------------------------------------------------------------------- | Default Timeout |-------------------------------------------------------------------------- */ 'tesseract.crypto.timeout' => 5.000 ];
How to use
<?php require 'vendor/autoload.php'; use Tesseract\Crypto\SDK\CryptoSDK; use Tesseract\Crypto\SDK\Http\StatusCode; use Tesseract\Crypto\SDK\Options\Config; use Tesseract\Crypto\SDK\Options\HttpClientConfig; $configs = include('config.php'); $httpClientConfig = new HttpClientConfig($configs[Config::BASE_URL], $configs[Config::ACCESS_KEY_ID], $configs[Config::SECRET_ACCESS_KEY], $configs[Config::DEBUG], $configs[Config::TIMEOUT]); $sdk = new CryptoSDK($httpClientConfig); $response = $sdk->auth(); if($response->getStatusCode() == StatusCode::OK) { if($response->getBody()->isReadable()) echo $response->getBody()->getContents(); }
统计信息
- 总下载量: 65
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-07