chobie/jira-api-restclient
PHP client for Jira’s REST API. Provides simple authentication, request handling, and endpoints for issues, projects, users, comments, attachments, workflows, and more—useful for integrating Jira operations into your apps, scripts, or automation jobs.
Pros:
findVersionByName, updateVersion, releaseVersion), worklogs (addWorklog, deleteWorklog, getWorklogs), project metadata (getProjectComponents, getProjectIssueTypes, getResolutions), and attachments (getAttachmentsMetaInformation, createAttachment with filename override). This significantly broadens use cases beyond basic issue CRUD, enabling:
issues per page) and issue count retrieval reduce manual API calls for large datasets.Cons:
Api::getPriorties → Api::getPriorities). Requires updates to existing Laravel service layers.Api::api() now requires $method and ClientInterface::sendRequest() requires $data, which may break legacy wrappers.$return_as_json → $return_as_array in Api::api().createRemoteLink requires careful handling of $global_id to avoid duplicates.getProjectComponents/getProjectIssueTypes may need custom mapping to Laravel’s schema.^7.0).issues per page helps but requires manual implementation for non-issue endpoints (e.g., worklogs).createAttachment must sanitize inputs to prevent path traversal (Laravel’s Str::of() or Storage facade recommended).App\Services\JiraService may conflict with renamed package classes. Use fully qualified namespaces (e.g., \Chobie\JiraApiRestClient\Api).use statements and method calls at once (risky for large codebases).use OldNamespace as Alias) during transition.event(new VersionReleased($projectId, $versionName));
// Listen in JiraService:
VersionReleased::listen(function ($event) {
$client->version()->release($event->versionName);
});
storage/app or directly in Jira? If hybrid, implement a sync job to avoid duplicates.Mockery to stub renamed methods during transition.config('jira.use_v2_api')).403 Forbidden for worklog updates)? Extend Laravel’s Handler:
public function render($request, Throwable $exception) {
if ($exception instanceof \Chobie\JiraApiRestClient\Exception\ApiException) {
return response()->json(['error' => $exception->getMessage()], 400);
}
}
AppServiceProvider to reflect namespace changes:
$this->app->singleton(\Chobie\JiraApiRestClient\Api::class, function ($app) {
return new \Chobie\JiraApiRestClient\Api(
config('services.jira.token'),
config('services.jira.url')
);
});
// app/Facades/Jira.php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class Jira extends Facade {
protected static function getFacadeAccessor() {
return \Chobie\JiraApiRestClient\Api::class;
}
}
Usage: Jira::getPriorities() (instead of old getPriorties).'jira' => [
'worklog' => [
'default_author' => env('JIRA_WORKLOG_AUTHOR', 'Laravel Bot'),
'time_tracking' => true,
],
'versions' => [
'auto_release_on' => ['version.released'], // Laravel events
],
],
class SyncWorklogs implements ShouldQueue
{
public function handle() {
$client = app(\Chobie\JiraApiRestClient\Api::class);
$laravelTasks = Task::whereNotNull('jira_issue_id')->get();
foreach ($laravelTasks as $task) {
$client->worklog()->add($task->jira_issue_id, [
'timeSpent' => $task->duration_minutes,
'comment' => 'Synced from Laravel',
]);
}
}
}
version.published):
VersionPublished::listen(function ($event) {
$client = app(\Chobie\JiraApiRestClient\Api::class);
$client->version()->release($event->name);
});
getPriorties).composer.json to pin the beta version:
"chobie/jira-api-restclient": "2.0.0-beta1"
composer update and resolve namespace conflicts.if (config('jira.enable_worklogs')) {
$client->worklog()->add(...);
}
How can I help you explore Laravel packages today?