cybercog/youtrack-rest-php
A PHP client for the YouTrack REST API that wraps issues, projects, users, and time tracking in an object-oriented interface. Works with YouTrack Cloud and standalone instances, using PSR-compatible HTTP clients and typed response models. Ideal for integrating YouTrack issue tracking into PHP applic...
Architecture fit. cybercog/youtrack-rest-php is a thin, framework-agnostic PSR-7 client — not a Laravel package in the conventional sense. There is no service provider, config publish, facade, or queue integration. Its shape is: YouTrackClient (facade over the API surface) → HttpClient contract (Guzzle adapter provided) → Authorizer contract (TokenAuthorizer, CookieAuthorizer). For a Laravel codebase this is a good substrate but a poor integration: we would own a small adapter layer (provider, config, container bindings, optional facade) regardless. The interface-driven design is the decisive positive — it lets us isolate the vendor behind our own port so the library is swappable for raw Guzzle or a future official SDK. The absence of typed DTOs is the main architectural gap: responses are arrays wrapped in YouTrackResponse, so every consumer performs its own shape assumptions. We should budget for a mapping layer (YouTrack issue/project/user → internal value objects) on top, otherwise array coupling spreads through the app.
Integration feasibility. High. Dependencies are narrow and mainstream (Guzzle 7, PSR-7/17/18), PHP 8.1–8.5 is exercised in CI, and the code is small enough to audit in an afternoon. Two auth strategies ship in-box: bearer token (stateless, preferred) and cookie/CookieAuthenticator (username/password + cookie caching, brittle under CSRF/session rotation). A POC covering "list projects, query issues, create issue, transition state" is roughly 1–3 engineer-days including adapter and tests. The real cost is not adoption but the surrounding operational shell (retry, observability, credential handling), which the library deliberately does not provide.
Technical risk.
declare(strict_types=1) everywhere, PHPStan level 8, PSR-12/StyleCI, PHPUnit 10.5 feature tests with Guzzle MockHandler, multi-PHP Docker matrix. This is better engineered than most 37-star PHP packages.ClientException (only 401/403 are specially mapped), so callers cannot distinguish throttling from genuine faults without inspecting the response.Key questions.
Stack fit. Compatible with Laravel 9+ on PHP 8.1+ (Laravel 11/12 require 8.2+, which the library supports). It coexists with — rather than replaces — Illuminate\Http\Client; that means two HTTP stacks in one application. Accept this, but standardize: route all YouTrack traffic through one Guzzle handler stack so proxies, timeouts, correlation headers, and telemetry are configured once. Do not let feature teams instantiate YouTrackClient ad hoc.
Recommended shape.
config/youtrack.php — base URI, auth mode, token sourced from secrets manager/env, timeout, retry policy.YouTrackServiceProvider binding HttpClient → GuzzleHttpClient (with our handler stack) and Authorizer → TokenAuthorizer.YouTrackGateway interface + implementation that wraps the vendor client, returns our DTOs, and is the only place Cog\YouTrack\Rest\* types appear. This is the insurance policy against abandonment.Migration path. If we currently call YouTrack via raw Guzzle or shell/cURL scripts: (1) introduce the gateway interface and move existing call sites behind it without changing behavior — a pure refactor with no dependency added; (2) implement the gateway with this library; (3) delete the old implementation. This inverts the risk: the library becomes an implementation detail we can replace with a fork or 500 lines of Guzzle in a day. If there is no existing integration (greenfield), skip step 1's dual implementation but keep the gateway — it costs little and preserves optionality.
Compatibility notes. PHP 8.1–8.5 is validated upstream; pin the minor version and gate upgrades behind our own CI (their PHPUnit suite runs cleanly and cheaply). Watch Octane: the token authorizer is stateless and safe; a cookie-caching authenticator is not obviously worker-safe — prefer tokens and avoid the cookie path entirely. Guzzle 7 is the only supported major; conflicts are unlikely but check for transitive pins if we also depend on SDKs that constrain guzzlehttp/guzzle.
Sequencing.
$skip/$top loops, not naive "fetch all").Maintenance. Low code churn expected — the library is a stable pass-through over an external API — but maintainer attention is unproven at 37 stars. Mitigations: pin exact versions, automate updates via Renovate/Dependabot, run the upstream test suite in our CI as a canary, and keep a documented fork policy (MIT permits it; the surface is small enough that forking is a realistic response to abandonment). Budget roughly 2–4 engineer-days per quarter for dependency and YouTrack version upkeep, plus incident time.
Support. No commercial support and no meaningful human-facing documentation beyond the repo's AGENTS.md (which is excellent for AI-assisted contributors and thin for onboarding humans). We will write and own an internal runbook: auth token rotation procedure, error-code-to-action table, sandbox instance details, and known API quirks. L1 triage should treat YouTrack failures as an external dependency, with a clear escalation to the owning team.
Scaling. The client is synchronous and blocking; throughput comes from queue concurrency, not from the library. Constraints to design around: YouTrack instance rate limits (self-hosted instances are frequently the bottleneck, not our PHP tier), pagination on large result sets, and payload size on issue descriptions/attachments. Use Guzzle keep-alive and a bounded worker pool; cap concurrency below the instance's limit and back off on 429. Memory: responses are fully buffered PSR-7 streams, so very large exports should be chunked by page rather than pulled whole.
Failure modes.
InvalidAuthorizationToken; needs alerting and a rotation runbook, not silent retries.AuthenticationException on 403; often a YouTrack role change, not a bug.ClientException; add a middleware that distinguishes 429/5xx and applies bounded retry with jitter, otherwise retries will be naive or absent.Ramp-up. For a PHP developer already fluent in Guzzle and PSR-7, productive in half a day; for a Laravel-only developer unfamiliar with PSR abstractions, 1–2 days. The interface-driven layout and AGENTS.md make AI-assisted contribution unusually smooth. Main onboarding cost is not the library but the undocumented domain: YouTrack's query language, workflow/state model, and custom-field shapes. Plan a short internal knowledge-share and a small set of golden-path examples (query issues, create issue, transition state) rather than relying on external docs.
TPM recommendation. Adopt at low-to-moderate strategic weight: real value in the tested, strictly-typed HTTP plumbing and exception mapping (saves roughly 1–2 weeks of build-and-test), but only behind an application-owned gateway, with token auth, and with an explicit quarterly exit-rehearsal. Do not let it become a load-bearing identity in the codebase; treat it as a replaceable adapter over a vendor API we will outlive.
How can I help you explore Laravel packages today?