gens-de-confiance/php-trustfully-api

Trustfully API 客户端

dev-master 2017-02-06 13:31 UTC

This package is not auto-updated.

Last update: 2021-11-22 00:06:14 UTC


README

使用 PHP5 编写的对 TrustFully API 的简单面向对象包装。

参见 TrustFully API 的文档。

功能

  • 遵循 PSR-0 规范和编码标准:自动加载友好
  • API 入口点实现状态
  • 社区
  • 联系
  • 会员
  • 赞助
  • 用户

要求

  • PHP >= 5.4
  • PHP cURL 扩展
  • PHP JSON 扩展
  • PHPUnit >= 4.0(可选)用于运行测试套件

安装

$ composer require gens-de-confiance/php-trustfully-api

使用方法

<?php

require_once 'vendor/autoload.php';

try {
    $client = new TrustFully\Client('https://api.trustfully.com/v1/', 'CLIENT_API_KEY');

    $me = $client->user->login('guillaume@gensdeconfiance.fr', 'azerty');

    // ...
    $communities = $client->community->all();
    // ...
} catch (\Exception $e) {
    die($e->getMessage());
}

或者,您可以在实例化客户端时指定一个主机来绕过 DNS 解析

<?php

    $client = new TrustFully\Client('https://10.17.10.17/v1/', 'CLIENT_API_KEY', 'api.trustfully.com');