juststeveking/php-sdk
A framework-agnostic PHP SDK that provides a clean, lightweight foundation for building and consuming API clients. It simplifies request handling and response structure for PHP and Laravel projects, making integrations easier to build and reuse.
Architecture fit. juststeveking/php-sdk is not an SDK for a specific API — it is a scaffold for building SDKs: a base client/connector, base request, and base response class layered so that concrete work (endpoint paths, auth headers, DTO hydration) lives in our subclasses. For a TPM, the architectural question is whether our roadmap contains a publishable PHP client whose value comes from being framework-agnostic. If yes, this package supplies the layering we would otherwise spend one to two sprints designing, at zero license cost. If our only consumer is a Laravel app, the framework's own HTTP client already covers us and this is pure overhead.
Integration feasibility. Technically simple and well-bounded: Composer install, one vendor namespace, no service provider, no facade, no config publishing. The work is not installation but wiring we own — a container singleton binding the client with an explicitly injected PSR-18 transport, a resource layer, DTO mapping, and error translation. There are no dependents in the wild, so we cannot lean on community examples; feasibility rests entirely on the team reading a small codebase (roughly an afternoon) and validating it with a single authenticated GET end-to-end before committing.
Technical risk. The dominant risks are not code quality:
Retry-After handling, rate limits, token refresh, pagination, and DTO hydration are deliberately out of scope. None of this arrives with the dependency, and bolting it on post-production is materially harder than doing it in the spike.Http::fake() has no effect; testing requires a PSR-18 mock bound in the container. Teams underestimate this workflow change.Key questions.
juststeveking/* class? (It should not.)Stack fit. The core is plain PHP with Laravel-friendly ergonomics, not Laravel-coupled. That is the whole point of choosing it: the "PHP" slot on the SDK roadmap then covers Symfony, Slim, and plain-PHP consumers without a second build effort — a scoping decision made once and inherited. Conversely, if we only ever ship to Laravel users, this is the wrong shelf.
Migration path. There is no meaningful migration from an existing client — this is greenfield scaffolding. The pragmatic path is a one-resource spike: pin 3.0.0 exactly, read the base client/request/response classes in vendor/, and build a single authenticated GET returning a typed DTO. That one path exercises config, transport, request building, response parsing, and error mapping, so friction surfaces immediately rather than at endpoint fifteen. If the spike succeeds, roll resources out incrementally behind our own client interface; if it fails, we have spent days, not a sprint.
Compatibility. Requires PSR-18/PSR-7 discipline and an explicitly bound HTTP client — relying on PSR-18 discovery is the most common first-hour failure in Laravel, either silently selecting an unexpected transport or dying with an unhelpful "no client found." Normalise the base URL in the constructor (trailing slashes produce //invoices, which some gateways 404). Treat PSR-7 response bodies as single-read streams and cache the decoded payload in a thin wrapper before building resources on top. Pin exact versions; treat every major as a source-reading exercise, not a composer update.
Sequencing.
Retry-After, idempotency keys on retried writes, token-provider closure for refresh, centralised error mapping to our own exception types.Generator.Maintenance. This is the central cost and it must be staffed, not assumed. We inherit an unaudited major-version treadmill: majors ship without migration notes, so each is a half-day of source reading and diff recording. We also own the omissions — retry, backoff, rate limiting, auth refresh, pagination, hydration. Scope discipline is a feature, but it is a feature we pay for with engineering time. Vendoring or pinning an inspected commit and treating the library as our own code converts an open-ended vendor risk into a scheduled, bounded task; that is the recommended posture.
Support. Zero dependents and modest stars mean no Stack Overflow answers, no blog posts, and essentially no engineers who have seen this codebase. Onboarding cost for new team members is ours in full, and the internal docs we write are the documentation. Escalation path is the named internal owner, not upstream.
Scaling. The abstraction scales comfortably to a modest, stable surface — roughly one to two dozen endpoints with predictable payloads. It does not scale into OAuth flows, webhook signature verification, streaming, or OpenAPI-driven contracts; at that point the honest answer is Saloon for HTTP concerns or a generator for spec fidelity, with our resource layer written in-house either way. Response streams are single-read, so high-volume sync work must cache decoded payloads and use generator-based pagination to keep memory flat.
Failure modes. (a) Silent transport drift via PSR-18 discovery — mitigated by explicit binding. (b) Third-party timeouts surfacing as 500s on user-facing pages — catch at the client boundary, rethrow as domain exceptions, decide early that a timeout during a web request degrades gracefully. (c) Leaked PSR-7 status codes and arrays into controllers and jobs, creating implicit contracts — centralise error mapping and DTO hydration once. (d) Undetected double-read of response bodies returning empty. (e) Upstream abandonment blocking a customer release — mitigated only by vendoring/forking with a named owner. (f) Major-version surprise discovered in production rather than in the spike.
Ramp-up. Installation is trivial; the non-obvious learning is the test harness (PSR-18 mocks, not Http::fake()) and the boundary discipline (resources free of Http::, config(), and Eloquent; no juststeveking/* types in public signatures). Budget one experienced PHP engineer for roughly a week to reach a confident go/no-go, then one to two sprints to a first publishable SDK inclusive of auth, retry, error mapping, and docs — the difference between a two-week and a two-month delivery is whether those omissions are estimated honestly up front.
How can I help you explore Laravel packages today?