limetecbiotechnologies/redmineapibundle

Symfony Bundle 用于包含 redmine api。

v1.0.0 2017-06-08 14:21 UTC

This package is not auto-updated.

Last update: 2024-09-20 19:44:29 UTC


README

Build Status

此包将 Redmine API Wrapper 集成到您的 Symfony 项目中

## 步骤1:安装 RedmineApiBundle

安装此包的首选方式是依赖 composer。

{
    "require": {
        // ...
        "limetecbiotechnologies/redmineapibundle": "~1.0"
    }
}

## 步骤2:启用包

最后,在 kernel 中启用该包

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new LimetecBiotechnologies\RedmineApiBundle\RedmineApiBundle(),
    );
}

## 步骤3:配置 RedmineApiBundle

在 app/config/config.yml 中添加 RedmineApiBundle 设置

redmine_api:
  clients:
    firstclient:
      token: your-api-token
      url: http://example.org/api/v3/
    secondclient:
      token: your-api-token
      url: http://example.com/api/v3/

第一个客户端自动定义为默认客户端。

## 步骤4:使用 redmine api

如果您想使用默认客户端,可以通过 "redmine_api" 服务标识符轻松获取客户端。

$api = $this->get('redmine_api');
$api->issue->show($ticket);

如果您想获取其他客户端之一,可以通过 "redmineapi.client.CLIENT_NAME" 服务标识符获取特定的客户端。

$api = $this->get('redmineapi.client.secondclient');
$api->issue->show($ticket);