ohdearapp/ohdear-php-sdk
Official PHP SDK for the Oh Dear API, built on Saloon v4. Manage monitors, retrieve user info, and handle API responses with typed DTOs. Supports API token authentication, configurable timeouts, and clear validation and error exceptions. Simplifies integrating Oh Dear monitoring into PHP application...
Architecture fit. This is a thin, first-party HTTP client over Oh Dear's REST API, built on Saloon v4. It is framework-agnostic PHP: no service provider, no facade, no publishable config, no package auto-discovery. Treat it as an outbound integration adapter, not a "Laravel package" in the conventional sense. The correct placement is behind an application-owned interface (e.g. MonitoringProvider) so domain code never imports OhDear\PhpSdk\* directly, and the SDK stays replaceable.
Integration feasibility. High. Construction is a single token plus an optional timeout; methods map 1:1 to API resources; return values are typed DTOs with enums for check types, results, and uptime splits, which removes a whole class of string-matching bugs. The exception taxonomy is small and usable — ValidationException::errors() for field-level failures, OhDearException for everything else. Realistic first slice (config, container binding, one read path) is 1–2 engineer-days.
Technical risk.
createMonitor is not documented as idempotent. Onboarding flows will create duplicates on retry. Requires a monitorByUrl() pre-check plus a local unique constraint.monitors() as an iterator but doesn't state whether it's lazy. On large accounts an eager iterator is a memory and latency fan-out.CheckType and CheckResult cases will grow upstream; any exhaustive match over them is a latent fatal error.Key questions.
Retry-After?monitors() paginate lazily, and what is the page-size ceiling?createMonitor idempotent on url, or is there any natural key?Stack fit. Laravel 10/11/12 with PHP 8.2+ (verify Saloon v4's floor). Because there is no Laravel coupling, you own all wiring: a config/services.php entry for token and timeout, a singleton binding in a service provider, and the adapter class. Cache reads where the domain tolerates staleness — monitor lists, certificate health, check summaries — via Cache::remember with short TTLs. Never cache writes. For Http::-free testing, use Saloon's mock client rather than hitting the live API.
Migration path. Purely additive unless you already call Oh Dear with hand-rolled Guzzle or Http:: calls, in which case port call sites method-by-method and delete the legacy client afterward. Sequence:
composer why saloonphp/saloon, PHP floor, lockfile diff. This is the go/no-go gate.me(), monitors(), monitor($id). Confirm pagination behaviour empirically.Compatibility. Three surfaces: Saloon major version (largest), PHP version floor, and enum drift. Pin with a caret constraint, track the lockfile, and add a CI job that resolves the latest allowed minor so upstream additions surface before production does. Wrap all enum consumption with a default branch.
Sequencing. Reads before writes; reversible writes before irreversible ones. Concretely: read paths → snooze/unsnooze and start/stop maintenance (fully reversible) → create/delete monitor and status page (irreversible, needs guardrails) → status page update automation (public-facing blast radius, ship last).
Maintenance. Low day-to-day — it's a thin first-party SDK — but you inherit the adapter, retry policy, and enum-drift handling. Budget roughly 0.25 FTE-days per quarter for version bumps and changelog review.
Support. Upstream is the Oh Dear product team, not a community. The README is effectively the API guide, with examples per resource — good enough that most integration questions are answered there. No evidence of an SLA or a community forum; assume small-vendor response times and keep integration ownership with your own on-call.
Scaling. You are bounded by Oh Dear's API rate limits, not by the SDK. The first thing to break will be per-tenant reads on page views — cache aggressively and prefer webhook/queue-driven refresh over request-time calls. Bulk provisioning (hundreds of tenants) must be chunked, queued, and backed off; a serial loop of createMonitor will be slow and will hit 429s. Iterating an entire account via monitors() is a fan-out risk worth a cap.
Failure modes and mitigations.
monitorByUrl() pre-check plus a local unique index; accept a small race and dedupe in reconciliation.CheckResult case arriving in a patch release. Default branches everywhere.Ramp-up. About one day for a mid-level Laravel developer to be productive: small surface, typed DTOs, documented examples. TPM effort is better spent upstream of the code — idempotency strategy, secrets handling, queue and retry policy, and reconciliation. The SDK solves none of those. Ship a one-page design note and a runbook before the first write path goes out.
How can I help you explore Laravel packages today?