This package requires php:^8.1
.
You can install it via composer:
composer require bluestone/redmine-api
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.
You can grab projects from Redmine API using this method :
$response = $redmine->project()->all();
foreach ($response->items as $project) {
echo $project->name;
}
You can grab issues from Redmine API using this method :
$response = $redmine->issue()->all();
foreach ($response->items as $issue) {
echo $issue->subject;
}
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;
}
You can grab time entries from Redmine API using this method :
$response = $redmine->timeEntry()->all();
foreach ($response->items as $timeEntry) {
echo $timeEntry->hours;
}
You can grab specific issue from Redmine API using this method :
$response = $redmine->issue()->get(1);
$issue = $response->items[0];
echo $issue->subject;
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 !"
}
Redmine API client is an open source project under MIT License and is open for contributions.