bluetea/jira-rest-api
Object-oriented PHP client for Atlassian JIRA REST API. Configure a Curl or Guzzle client with basic authentication, then use endpoint classes (e.g., ProjectEndpoint) to call JIRA /rest/api/2 methods and retrieve projects and more.
Pros:
CurlClient, GuzzleClient), allowing integration with Laravel’s native HTTP stack (e.g., GuzzleHttp via illuminate/http-guzzle).ProjectEndpoint, IssueEndpoint) align with Laravel’s service-layer patterns, enabling loose coupling and testability.ServiceProvider or Facade patterns).Cons:
Issue, User, or Search endpoints in the example). Custom endpoints may require manual implementation.ServiceProvider bindings, Config support, or Artisan commands) out of the box.Http facade), reducing friction for integration.Auth system could be extended to handle this.AppServiceProvider.JsonResponse or Eloquent models (via ->toArray()) can handle serialization/deserialization.Guzzle raw requests).Exception handler or middleware (e.g., App\Exceptions\Handler) can augment this.Cache facade or throttle middleware can be layered on top.Auth system integrate with Basic Auth?Issue, Search, Webhook) missing?Http tests)?Guzzle requests with Laravel’s Http client?GuzzleClient with Laravel’s Http facade (e.g., Http::withBasicAuth()->get()) for consistency.AppServiceProvider:
$this->app->bind(JiraProjectEndpoint::class, function ($app) {
return new ProjectEndpoint(
new GuzzleClient(
config('services.jira.url'),
new BasicAuthentication(
config('services.jira.username'),
config('services.jira.password')
)
)
);
});
config/services.php:
'jira' => [
'url' => env('JIRA_URL', 'https://jira.example.com/rest/api/2'),
'username' => env('JIRA_USERNAME'),
'password' => env('JIRA_PASSWORD'),
],
Jira facade to simplify usage:
// app/Facades/Jira.php
namespace App\Facades;
use Illuminate\Support\Facades\Facade;
class Jira extends Facade { public static function getFacadeAccessor() { return 'jira'; } }
AppServiceProvider:
$this->app->singleton('jira', function ($app) {
return new JiraManager($app['config']['services.jira']);
});
Phase 1: Proof of Concept
GuzzleClient with Laravel’s Http facade.ProjectEndpoint::findAll()) against a staging JIRA instance.Phase 2: Service Layer Integration
JiraService class to encapsulate business logic (e.g., "Create a JIRA issue from a Laravel form").class JiraService {
public function createIssue(array $data) {
$endpoint = new IssueEndpoint($this->client);
return $endpoint->create($data);
}
}
JiraService to the container and inject dependencies.Phase 3: Laravel-Specific Enhancements
JiraException).Cache::remember)./rest/api/3 vs. Server’s /rest/api/2).class JiraApiWrapper {
public function __call($method, $args) {
if (config('jira.api_version') === 3) {
return $this->callCloudApi($method, $args);
}
return $this->callServerApi($method, $args);
}
}
composer require bluetea/jira-rest-api)..env and config/services.php.JiraService and bind it to the container.ProjectEndpoint).IssueEndpoint).Event system (e.g., trigger JIRA webhooks on Eloquent model events).Monolog channel).composer.json to avoid accidental updates.How can I help you explore Laravel packages today?