rolandsaven/bugherd-bundle

这是一个用于与Bugherd API v2交互的Symfony 2-3 Bundle

安装: 5

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:symfony-bundle

0.1.0 2016-08-02 21:52 UTC

This package is auto-updated.

Last update: 2024-09-10 22:01:02 UTC


README

Build Status GitHub license Packagist

这是一个通过 php-bugherd-api 与Bugherd API v2交互的Symfony 2-3 Bundle。

需求

  • 一个Bugherd账号
  • PHP 5.5+
  • Symfony 2.8+

安装

使用 Composer 将此Bundle添加到您的Symfony应用程序中。

在您的 composer.json 文件中添加 rolandsaven/bugherd-bundle

{
    "require": {
        "rolandsaven/bugherd-bundle": "dev-master"
    }
}

编辑 AppKernel.php,插入以下内容

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

要使用API,请从BugHerd的 设置 > 一般设置 中为您的组织生成一个API密钥,并将其添加到 config.yml

bugherd:
    api_key: your_bugherd__api_key

最后,运行 composer update

访问Bugherd API

在控制器中,您可以通过以下方式访问Bugherd客户端和API资源

// Get the BugHeard Api Client
$bugherd = $this->get('bugherd');

/** Projects **/
// Get all projects
$projects = $bugherd->api('project')->all();

// Get all active projects
$active_projects = $bugherd->api('project')->allActive();

// Get all projects with name/id pairs
$projects = $bugherd->api('project')->listing($forceUpdate, $reverse);

// Get all active projects with name/id pairs
$active_projects = $bugherd->api('project')->listingActive($forceUpdate, $reverse);

// Get project id given its name
$id = $bugherd->api('project')->getIdByName($name);

// Get a project
$project = $bugherd->api('project')->show($id);

// Create a project
$project = $bugherd->api('project')->create(array(
    'name'      => 'Name of the Project',
    'devurl'    => 'http://example.com/',
    'is_active' => true,
    'is_public' => false,
));

/** Users **/
// Get all users
$users = $bugherd->api('user')->all();

// Get all guests
$guests = $bugherd->api('user')->getGuests();

// Get all members
$members = $bugherd->api('user')->getMembers();

/ Tasks **/
// Get a task
$task = $bugherd->api('task')->show($projectId, $taskId);

// Create a task
$task = $bugherd->api('task')->create($projectId, array(
    'description'      => 'Some description',
    'requester_id'     => $requester_id,
    'requester_email'  => $requester_email
));

// Update a task
$task = $bugherd->api('task')->update($projectId, $taskId, array(
    'description'      => 'Some new description',
));

// Get all tasks
$tasks = $bugherd->api('task')->all($projectId, array(
    'status' => 'backlog',
    'priority' => 'critical'
));

/** Organization **/
// Get organization information
$organization = $bugherd->api('organization')->show();

/** Comments **/
// Create a comment
$comment = $bugherd->api('comment')->create($projectId, $taskId, array(
    'text'      => 'some comment',
    'user_id'     => $user_id,
    'user_email'  => $user_email
));

// Get all comments
$comments = $bugherd->api('comment')->all($projectId, $taskId);


/** Webhooks **/
// Get all webhooks
$webhooks = $bugherd->api('webhook')->all();

// Create a webhook
$webhook = $bugherd->api('webhook')->create(array(
    'target_url' => 'http://example.com/tasks/create',
    'event' => 'task_create' // this could be task_update, task_destroy, comment
));

// Delete a webhook
$bugherd->api('webhook')->remove($webhookId);

贡献

此库仍在开发中。欢迎PR,包括PHP SDK php-bugherd-api

作者

此库由来自 OnwwwardRoland Kalocsaven 编写和维护。

参考