secucard/secucard-connect

secucard connect PHP客户端SDK


README

如果您开始一个新的项目,请使用此SDK: https://github.com/secuconnect/secuconnect-php-sdk

需求

Composer

您可以通过 Composer 安装绑定。将其添加到您的 composer.json

{
  "require": {
    "secucard/secucard-connect":"^1.26.0"
  }
}

然后通过以下方式安装

composer install

要使用绑定,请使用Composer的自动加载

require_once('vendor/autoload.php');

入门指南

使用客户端凭据的简单用法如下

include "vendor/autoload.php";

$config = array();

$credentials = new ClientCredentials('your-id','your-secret')

$fp = fopen("/tmp/secucard_php_test.log", "a");
$logger = new secucard\client\log\Logger($fp, true);

// general storage, here used shared for tokens and internal caching, but recommendation is to split up in two 
 $store = new FileStorage('your-storage-file-path');
 
// create Secucard client
$secucard = new SecucardConnect($config, $logger, $store, $store, $credentials);

// use secucard client to get available loyalty/cards list
$list = $secucard->Loyalty->Cards->getList();

文档

请参阅http://developer.secuconnect.com/doc/guide以获取最新的文档。

测试

为了运行测试,请首先通过Composer安装PHPUnit

composer update --dev

要运行测试套件

./vendor/bin/phpunit