定制 bluestone/redmine-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bluestone/redmine-api

最新稳定版本:v1.2.6

Composer 安装命令:

composer require bluestone/redmine-api

包简介

Redmine API client

关键字:

README 文档

README

Run tests Latest Stable Version

Installation

This package requires php:^8.1.
You can install it via composer:

composer require bluestone/redmine-api

Usage

First of all, you need to construct our service with a Guzzle client like this :

$httpHandler = new \Bluestone\Redmine\HttpHandler(
    baseUri: 'https://redmine.org'
);

$redmine = new \Bluestone\Redmine\Client($httpHandler);

Let's discuss all possibilities one by one.

Get projects

You can grab projects from Redmine API using this method :

$response = $redmine->project()->all();

foreach ($response->items as $project) {
    echo $project->name;
}

Get issues

You can grab issues from Redmine API using this method :

$response = $redmine->issue()->all();

foreach ($response->items as $issue) {
    echo $issue->subject;
}

Get project's versions

You can grab project's versions from Redmine API using this method :

$project = new \Bluestone\Redmine\Entities\Project([
    'id' => 42,
])

$response = $redmine->version()->all($project);

foreach ($response->items as $version) {
    echo $version->name;
}

Get time entries

You can grab time entries from Redmine API using this method :

$response = $redmine->timeEntry()->all();

foreach ($response->items as $timeEntry) {
    echo $timeEntry->hours;
}

Get specific issue

You can grab specific issue from Redmine API using this method :

$response = $redmine->issue()->get(1);

$issue = $response->items[0];

echo $issue->subject;

Update an issue

You can update an issue from Redmine API using this method :

$issue = new \Bluestone\Redmine\Entities\Issue([
    'id' => 1,
    'subject' => 'Hello from API',
    'project' => new Project(id: 1),
    'note' => 'Update an issue from API',
]);

$response = $redmine->issue()->update($issue);

if ($response->statusCode === 204) {
    echo "Well done !"
}

Contributing

Redmine API client is an open source project under MIT License and is open for contributions.

统计信息

  • 总下载量: 541
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-11-22