silinternational/idp-id-broker-php-client

PHP 客户端,用于与我们的 IdP ID Broker API 交互:https://github.com/silinternational/idp-id-broker

4.4.0 2024-09-20 07:27 UTC

README

PHP 客户端,用于与我们的 IdP ID Broker API 交互。

此客户端基于 Guzzle 构建,Guzzle 是 PHP HTTP 客户端。Guzzle 提供了一种简单的方式来创建 API 客户端,通过使用类似 Swagger 的格式描述 API,无需自行实现每个方法。因此,支持更多 API 相对简单。

安装

使用 Composer 进行安装非常简单

$ composer require silinternational/idp-id-broker-php-client

用法

示例

<?php

use Sil\Idp\IdBroker\Client\IdBrokerClient;

$idBrokerClient = new IdBrokerClient(
    'https://api.example.com/', // The base URI for the API.
    'DummyAccessToken', // Your HTTP header authorization bearer token.
    [
        'http_client_options' => [
            'timeout' => 10, // An (optional) custom HTTP timeout, in seconds.
        ],
    ]
);

$users = $idBrokerClient->listUsers();

用户信息

此客户端返回的用户信息(例如通过 getUser(...))可以包括以下字段

  • employee_id(字符串)
  • first_name(字符串)
  • last_name(字符串)
  • display_name(字符串)
  • username(字符串)
  • email(字符串)
  • active(字符串:'yes' 或 'no')
  • locked(字符串:'yes' 或 'no')

测试

要运行此单元测试,请运行 make test

Guzzle 服务客户端说明