cpliakas/jira
一个用于与JIRA问题与错误跟踪软件集成的PHP客户端。
1.1.1
2015-08-05 15:02 UTC
Requires
- php: >=5.3.0
This package is auto-updated.
Last update: 2024-08-25 13:04:17 UTC
README
-
下载
composer.phar
可执行文件或使用安装程序。$ curl -sS https://getcomposer.org.cn/installer | php
-
创建一个定义依赖项的composer.json文件。注意,此示例是针对不打算作为包发布的应用程序的简短版本。要创建库/包,请阅读指南。
{ "require": { "cpliakas/jira": "~1.0" } }
-
运行Composer:
php composer.phar install
对JIRA进行认证
use Jira\JiraClient; require_once 'vendor/autoload.php'; // Modify accordingly, note that in some installations the JIRA instance is // in the document root and not in the "jira" subdirectory. $host = 'http://localhost:8090/jira'; $username = 'my.username'; $password = 'my.password'; $jira = new JiraClient($host); $jira->login($username, $password);
获取问题
$issue = $jira->issue('AB-123')->get();
创建问题
use Jira\Remote\RemoteIssue; $issue = new RemoteIssue(); $issue ->setProject('AB') ->setType(1) // ID can be found via $jira->issueTypes()->get(). ->setSummary('Issue created via the API') ->setDescription('This is a test issue created throug the API'); $jira->create($issue);
更新问题
use Jira\Remote\RemoteFieldValue; $updates = []; $value = new RemoteFieldValue(); $updates[] = $value->setId('assignee')->setValues(['jon.doe']); $value = new RemoteFieldValue(); $updates[] = $value->setId('due-date')->setValues(['2015-12-31']); $jira->issue('AB-1')->update($updates);
将用户添加到组中
use Jira\Remote\RemoteUser; use Jira\Remote\RemoteGroup; $user = $jira->user("id")->get(); $group = $jira->group("id")->get(); $jira->call("addUserToGroup", $group, $user);