linkorb/silex-provider-hubclient

提供对 Hub 的客户端。

v2.0.0 2017-11-29 13:23 UTC

This package is auto-updated.

Last update: 2024-08-29 04:25:35 UTC


README

提供来自 perinatologie/hub-client-php 的两个服务:

  • ApiClientFactory 作为名为 hub_client.factory 的服务,可以创建 HubV3Client 和 HubV4Client 的实例
  • HubV3Client 作为名为 hub_client.service 的服务

安装

使用 composer 安装:

$ composer require linkorb/silex-provider-hubclient

然后配置并注册提供者:

// app/app.php
use LinkORB\HubClient\Provider\HubClientProvider;
...
$app->register(
    new HubClientProvider,
    ['hub_client.url' => getenv('HUB_CLIENT_URL'),
    // if you want to use the factory to create a HubV4Client then add the
    // url of the UserBase Json Web Token authentication endpoint
    'hub_client.userbase_url' = getenv('HUB_CLIENT_USERBASE_URL'),
    // add these parameters if you want to directly create the HubV3Client
    // with a fixed set of credentials
    'hub_client.username' = getenv('HUB_CLIENT_USERNAME'),
    'hub_client.password' = getenv('HUB_CLIENT_PASSWORD')]
);