bluetea / jira-rest-api-bundle

Atlassian JIRA REST API Symfony2 Bundle

安装次数: 8,672

依赖: 1

建议者: 0

安全: 0

星标: 2

关注者: 6

分支: 4

开放问题: 0

类型:symfony-bundle

dev-master 2017-02-23 13:43 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:43:38 UTC


README

此 Symfony2 Bundle 使用 JIRA REST API PHP 库。此 Bundle 通过依赖注入和标记服务添加配置并初始化端点。

安装

将此 Bundle 添加到您的 composer.json 文件中

composer.phar require "bluetea/jira-rest-api-bundle" dev-master

在 AppKernel.php 中启用它

new Bluetea\JiraRestApiBundle\BlueteaJiraRestApiBundle(),

将配置添加到您的 config.yml 文件中

bluetea_jira_rest_api:
    api_client: guzzle
    api:
        jira: https://atlassian.domain.com/rest/api/2/
        crowd: https://atlassian.domain.com/crowd/rest/usermanagement/latest/
    authentication:
        jira:
            type: basic # or anonymous
            username: username # mandatory is basic authentication is chosen
            password: password # mandatory is basic authentication is chosen
        crowd:
            type: basic # or anonymous
            username: username # mandatory is basic authentication is chosen
            password: password # mandatory is basic authentication is chosen

使用方法

<?php

namespace Acme\DemoBundle\Controller;

class TestController extends Controller
{
    public function testAction()
    {
        $projectEndpoint = $this->get('jira_rest_api.jira.endpoint.project');
        // Get all projects
        return new JsonResponse($projectEndpoint->findAll());
    }
}

请查阅 JIRA REST API PHP 库 以获取所有端点。端点在 services.yml 中加载。如果您想添加自定义端点,可以在自己的 Bundle 中完成此操作,并用 jira_rest_api.jira_endpoint 标签标记 JIRA 端点,以及用 jira_rest_api.crowd_endpoint 标签标记 Crowd 端点。

示例

parameters:
    acme_demo.endpoint.custom.class: Acme\DemoBundle\Endpoint\CustomEndpoint

services:
    acme_demo.endpoint.custom:
        class: %acme_demo.endpoint.custom.class%
        tags:
            - { name: jira_rest_api.jira_endpoint }

如果您在 JIRA REST API PHP 库 中扩展了端点,我们将非常感谢您提交一个 PR!

文档

JIRA 6.3.10 REST API 文档

JIRA REST API 开发者文档

Crowd REST 资源

调试

安装 JIRA REST API 浏览器以测试您的调用。您可以在 https://atlassian.yourdomain.com/plugins/servlet/restbrowser 找到它。您得到了 404?请先通过插件管理器安装插件。