canaltp/tyr-bundle

Symfony2 扩展包,提供 Tyr 服务。

安装次数: 2,290

依赖者: 0

建议者: 0

安全性: 0

星标: 1

关注者: 33

分支: 2

类型:symfony-bundle

1.3.0 2016-02-25 08:56 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:42:13 UTC


README

Symfony2 扩展包,提供了一个具体的 AbstractTyrService

此扩展包使用 TyrComponent

安装

使用 composer 安装

{
    "require": {
        "canaltp/tyr-bundle": "1.1.x"
    }
}

更新 AppKernel.php

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new CanalTP\TyrBundle\CanalTPTyrBundle(),
        );
    }

更新 app/config.yml

# Tyr api configuration
canal_tp_tyr:
    url:            %tyr_url%
    end_point_id:   2 # Optional, can also be set with setEndPointId

parameters.yml 中添加参数

parameters:
    tyr_url: http://tyr.dev.canaltp.fr/v0/

使用方法

// Accessing service
$tyrApi = $container->get('canal_tp_tyr.api');
$tyrApi->setEndPointId(1); // If not set in configuration

// Call api
$user = $tyrApi->getUserByEmail('...');

许可证

本项目遵循 GPL-3.0 许可证