origami-mp/origami-api-sdk
origami-mp/origami-api-sdk is a PHP SDK for the Origami API, providing a convenient client to streamline authentication and endpoint requests. It helps Laravel and PHP developers integrate with Origami services faster with less boilerplate and more consistent API handling.
Architecture fit
The SDK imposes a well-defined layering: API repository (public seam) → client repository (HTTP transport) → DTO (response parsing/validation), with param bags for requests, enums for constrained values, and traits + contracts for cross-cutting behavior. For a Laravel application this is a genuinely clean integration seam — business code talks to repositories and receives typed DTOs, not arrays or raw Response objects.
Three properties matter most for fit:
Data (authenticated), Guest (public) and Oauth repositories model three distinct credential flows as separate namespaces rather than a boolean flag. Good separation; it also means the app owns three credential lifecycles, not one.Fit is high if the Origami API is a first-class dependency of the product (as it appears to be for origami_admin_v2). Fit is low if you only need one or two endpoints: you would inherit the full DTO/param-bag/enum surface and a strict set of contribution conventions for a fraction of the value.
Integration feasibility
Mechanically straightforward — a Composer package under MIT. Feasibility is gated on facts not in evidence, which is where the TPM effort should go:
| Unknown | Why it blocks | How to resolve |
|---|---|---|
| Distribution channel | 0 dependents alongside a real consumer (origami_admin_v2) implies install via VCS/path repository or a private registry, not Packagist. CI and lockfile reproducibility depend on this. |
Inspect the consumer's composer.json |
| PHP / Laravel support matrix | Pint with the Laravel preset implies Laravel 9+ idioms, but no composer.json constraints are documented. |
Read require / CI matrix |
| Package bootstrap | The conventions reference "classes adapting Laravel" in helpers, implying Laravel coupling without necessarily shipping a service provider or publishable config. Manual container bindings may be required. | Spike: install into a scratch app, resolve one Data repository end-to-end |
| HTTP client, timeouts, retries | Not visible in the conventions. Whether the SDK exposes Guzzle handler config determines if retry/backoff is yours or theirs. | Read a client repository base class |
Realistically a 2–5 day spike answers all four. That is cheap relative to the cost of discovering a missing retry hook after go-live.
Technical risk
| Risk | Severity | Notes |
|---|---|---|
| API contract drift | High | Response shapes are defined by the sibling repo origami_api. The SDK validates them, so drift becomes a production exception rather than data corruption — better, but still a runtime outage on unversioned deploys. Mitigation: pin SDK version, deploy SDK bumps with API changes, alert on OrigamiApiSdkException rate. |
| Enum drift | Medium–High | PHP enums are closed sets. A new API enum value reaching a deployed app produces an unhandled case. Rule::enum() protects outbound validation but not inbound decoding. Confirm the DTO fallback behavior for unknown enum values — this is the single most likely 3 a.m. failure. |
| Credential handling | Medium | Three auth flows, Oauth included. Confirm token storage, refresh, and whether refresh is SDK-owned or app-owned; ambiguity here usually ends up duplicated in every consumer. |
| Bus factor | Medium–High | Zero stars, zero dependents, opaque ownership. One team, likely one or two authors. |
| Unproven at scale | Medium | No external consumers means edge cases (pagination boundaries, partial list failures, large payloads) are validated only by whatever origami_admin_v2 happens to exercise. |
| Release metadata anomaly | Low | "Last release 2026-08-07" is future-dated. Likely a monorepo tag or CI artefact, but verify provenance before pinning — it undermines confidence in the version history you are about to depend on. |
| Ceremony tax | Low–Medium | The conventions are strict (Pint, element ordering, spread-over-array_merge, one-rule-one-place docs). Excellent consistency; any local fork or extension carries real cost. |
Key questions
origami_api and the SDK — one team or two? Is there a stated versioning/semver policy for breaking response changes?origami_admin_v2 the only consumer, and is it pinned to a tag or tracking a branch?Stack fit
Laravel-first by construction: Laravel Pint preset, Laravel validation rules (Rule::enum()) in DTOs, and helper classes that explicitly adapt Laravel. That is a good sign for idiom alignment and a bad sign for portability — do not expect this to drop into Symfony or a framework-agnostic service without friction.
Recommended placement: one adapter module at the application boundary, not SDK types scattered through controllers, jobs, and Blade views. Concretely:
client repositories (or a factory for them) as singletons in a service provider, configured from config/services.php / env — never construct them inline.API repository in a thin application-level interface (e.g. CustomerLookup) and return your own models or plain value objects. Keep DTOs inside the module.Migration path
Assume the likely starting state is raw Http:: / Guzzle calls to the Origami API scattered across the app.
Compatibility
Pin exactly ("x.y.z", not ^x.y) for the first two quarters. Pin for two reasons: the consumer base is too small to trust semver discipline, and DTO changes are precisely the kind of breaking change that semver minor bumps are supposed to preclude and frequently do not. Add a CI job that resolves the lockfile against the pinned tag so a yanked or re-tagged release is caught before deploy.
Confirm the PHP and Laravel constraints against the app's matrix before sequencing work — a PHP minor mismatch invalidates the whole plan.
Sequencing
| Phase | Work | Gate |
|---|---|---|
| 1. Diligence (2–5 days) | Spike install; read composer.json, a client repository base class, one DTO and one exception family; answer questions 1–8 |
Go/no-go |
| 2. Decoupling (1–2 sprints) | Introduce adapter interfaces over existing HTTP calls; no SDK | Interfaces stable, tests green |
| 3. Pilot (1 sprint) | Migrate one read-only Guest endpoint and one Data endpoint; wire exception handling + alerting |
Error rate flat vs legacy for 2 weeks |
| 4. Auth hardening | Confirm Oauth token refresh ownership; implement in one place |
Token expiry handled without user-visible failure |
| 5. Broad migration | Remaining endpoints, ordered by traffic × risk (low-traffic first) | — |
Recommendation: conditional go. The SDK is a well-designed thin layer whose main cost is coupling to an API you are already coupled to — that is a favorable trade. Proceed on the strength of phases 1–3, and treat the diligence gate as real: if ownership, versioning policy, or enum-drift behavior are unanswerable, the correct outcome is to keep the adapter layer from phase 2 and skip the SDK entirely. That leaves you no worse off and materially more flexible.
Maintenance
Low ongoing code maintenance — the SDK is thin and does no scheduling, caching, or state management. The maintenance cost sits elsewhere:
sdk-conventions skill is unusually well-structured — indexed rule files, references to real test classes, an explicit "don't invent a convention, follow the closest existing pattern" rule. That is a genuine maintenance asset and will materially cut onboarding time.Support
This is the weakest dimension and the one to escalate. Zero stars and zero dependents means no external support surface: no issue history to search, no Stack Overflow corpus, no third-party blog posts. Every question routes to the owning team. Two operational requirements follow:
OrigamiApiSdkException with the exception family, the repository class, and the endpoint — the exception hierarchy is designed for exactly this discrimination and is wasted if you log a generic string.Scaling
The SDK does not scale the thing that will actually limit you: the Origami API. Treat the SDK as a pass-through and locate all capacity concerns server-side.
Client-side considerations that do matter at volume:
Failure modes
Ranked by likelihood × blast radius:
Data/Oauth exceptions. Blast radius is the whole authenticated surface, so this needs a distinct alert rather than a generic error counter.Ramp-up
Favorable, and this is the package's most underrated quality.
Bottom line for operations: low code-maintenance burden, favorable ramp-up, and one materially unhedged exposure — you are adopting an unproven internal SDK with a single owning team and no external support corpus. That is acceptable for an internal product where the API is already a hard dependency, provided the diligence gate confirms ownership, versioning policy, and enum-drift behavior, and provided you invest early in the adapter boundary and the telemetry that replaces the community support you will not have.
How can I help you explore Laravel packages today?