wrapit/php-sdk

此包已被弃用且不再维护。未建议替代包。

WrapIt SDK for PHP

0.1.4 2018-01-13 13:23 UTC

This package is not auto-updated.

Last update: 2022-02-01 13:09:13 UTC


README

Build Status Code Coverage Packagist

安装

WrapIt SDK 可以通过 Composer 安装。运行以下命令

composer require wrapit/php-sdk

使用

简单的 GET 示例:获取用户资料数据

$wi = new \WrapIt\WrapIt([
    'domain' => '{domain}',
    'client_id' => '{client-id}',
    'client_secret' => '{client-secret}'
]);

// Use the LoginHelper to get an AccessToken

$userhelper = new \WrapIt\Helpers\WrapItUserHelper($wi, "{access-token}");

try {
    // Get data from the /people/me api
    $user = $userhelper->getUserData("me");
} catch (\WrapIt\Exceptions\WrapItResponseException $e) {
    echo 'The API returned an error: ' . $e->getMessage();
    exit;
}

echo 'Logged in as ' . $user["name"];