tefps/clients-bundle

TeFPS API 的 Symfony 扩展包

安装次数: 6,338

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 30

分支: 0

开放问题: 0

类型:symfony-bundle

1.1.0 2017-11-02 11:03 UTC

This package is not auto-updated.

Last update: 2024-09-21 15:01:19 UTC


README

安装

步骤 1: 下载扩展包

打开命令行,进入您的项目目录,并执行以下命令以下载此扩展包的最新稳定版本

$ composer require tefps/clients-bundle "~1"

此命令要求您全局安装 Composer,如 Composer 文档中的安装章节中所述。

步骤 2: 启用扩展包

然后,通过将其添加到项目 app/AppKernel.php 文件中注册的扩展包列表中来启用扩展包

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Tefps\TefpsClientsBundle\TefpsClientsBundle(),
        );

        // ...
    }

    // ...
}

⚠️ 注意,您应该为所有客户端使用相同的 OAuth2HttpClient 实例。

TefpsTvClient - 使用方法

<?php

use Tefps\TefpsClientsBundle\Tv\TefpsTvClient;
use Tefps\TefpsClientsBundle\Auth\OAuth2HttpClient;

// ...

$client = new TefpsTvClient(new OAuth2HttpClient(
        'http://tefps-directory-host:port',
        'clientId',
        'clientSecret'),
        'http://tefps-tv-host:port'
      );

$tv = $client->fetchTv("cityId", "tvId");

TefpsSubscriberClient - 使用方法

<?php

use Tefps\TefpsClientsBundle\Tv\TefpsSubscriberClient;
use Tefps\TefpsClientsBundle\Auth\OAuth2HttpClient;

// ...

$client = new TefpsSubscriberClient(new OAuth2HttpClient(
        'http://tefps-directory-host:port',
        'clientId',
        'clientSecret'),
        'http://tefps-subscriber-host:port'
      );

$subscriber = $client->fetchSubscriber("cityId", "subscriberId");