mirafive/sdk-php
A PHP SDK for integrating Mirafive services into your applications. Install via Composer, configure your credentials, and interact with the API through a simple, consistent client designed for PHP and Laravel projects.
The v1.0.0 release is a framework-agnostic PHP analytics and feature-flag SDK, not an explicitly Laravel-packaged integration. The public surface is MiraFive\Mira for event ingestion and MiraFive\Flags\MiraFlags for flag evaluation. Architecture fit is therefore moderate: the SDK is Composer-installable and standards-oriented, but Laravel adoption depends on writing or validating a thin adapter for container bindings, configuration, consent resolution, cache wiring, HTTP client selection, and lifecycle flushing.
Key architecture considerations:
track() and identify(), immediate send(), and lifecycle flush(). This fits request/response Laravel apps if flush is wired into termination or a queued delivery path; it is riskier in queue workers, Octane, and other long-running processes unless flush points are explicit.Key questions for the vendor or integration owner:
handOff and deliverPrepared() be used with Laravel queues, and what are the retry/idempotency expectations from the queue worker?validation_failed drops, circuit-breaker opens, refused identifiers, and unreadable flag documents exposed for observability?Retry-After, and how is full-jitter backoff configured?Mira::DEFAULT_HOST overrides managed across environments?flush() on shutdown reliable under PHP-FPM, Laravel Octane, queue workers, and destructors, or should production rely only on explicit termination hooks?Stack fit is best described as “Laravel-compatible with adapter work.” The SDK’s use of PSR-18 and PSR-16 is the right foundation, and enabled: false supports local/test environments cleanly. However, the release notes do not show a Laravel package, service provider, config file, or queue integration. A TPM should plan a small integration layer rather than expecting a native Laravel package.
Recommended integration approach:
mirafive/sdk-php behind a feature branch, confirm PHP/Laravel compatibility, and bind MiraFive\Mira and MiraFive\Flags\MiraFlags as container singletons or scoped services. Centralize host, mode, cache store, HTTP client, flushOnShutdown, flagsRefreshSeconds, and enabled configuration in Laravel config and environment variables.MiraFive calls across controllers, jobs, and models.handOff / deliverPrepared() for queued delivery before high-volume rollout. For queue workers and Octane, define explicit flush points; do not rely solely on shutdown or destruction.MiraFlags::snapshot() and document: for local and staging evaluation. Test ETag revalidation, stale-cache behavior, consent/opt-out behavior per FLAGS.md §5.1, segment lookup, exposure marking, and escaped browser bootstrap output. Validate against the shared MIRA FIVE fixtures and at least one representative production flag document.validation_failed events, refused identifiers, unreadable documents, and dropped batches. The SDK reports some of these, but the application must route them into its monitoring stack.enabled: false in local/test, enable in staging with a non-production project or host, then canary a small production surface. Roll back by disabling the SDK, removing flush hooks, and retaining the adapter boundary. If replacing an existing analytics or flag provider, dual-write during the pilot and compare delivery and flag-evaluation parity.Compatibility risks to resolve early: long-running process lifecycle, queue-worker flushing, PSR-16 cache semantics, PSR-18 client discovery, consent storage, and whether the SDK’s shutdown flush can block request termination within the 3 s deadline. The migration path is greenfield rather than a breaking upgrade, but initial adoption should still be sequenced as an integration spike, staging validation, canary, and then production rollout.
Maintenance burden is moderate and front-loaded. The package is new at v1.0.0, so the team should pin a major version, monitor releases, and keep the adapter layer thin enough to absorb SDK changes. The PSR abstractions reduce lock-in, but they also mean the application owns more integration code than a native Laravel package would require. A runbook should cover configuration, consent mode, cache selection, flush points, and rollback via enabled: false.
Support and observability need deliberate ownership. The SDK provides useful seams, but production support requires alerts on flush failures, circuit-breaker opens, retry storms, dropped validation_failed events, refused identifiers, and unreadable flag documents. Vendor documentation for PROTOCOL and FLAGS should be available to on-call staff, not just to the implementing engineer.
Scaling characteristics are reasonable for an SDK of this type: batches cap at 1,000 events and 1 MiB, flags evaluate locally after retrieval, and ETag revalidation reduces document transfer. The main scaling risk is not the batch size but delivery coupling. A synchronous flush with a 3 s deadline and 1 s connect timeout can still add latency if placed poorly. High-volume applications should use queued delivery or a background flush strategy. The shared PSR-16 circuit breaker is operationally efficient but can create correlated suppression across all processes; that must be visible in dashboards and reviewed against flag-critical use cases.
Primary failure modes:
validation_failed events are dropped and partially resent under a derived batch id, so downstream counts may differ from application-side counts.document is reported, but the application must decide whether to fail closed, use stale cache, or fall back.Ramp-up should be small and time-boxed: one backend engineer for the SDK/Laravel adapter, one product or analytics owner for event schema and consent behavior, and one platform/on-call representative for observability and rollout. A basic integration spike is likely 1–2 engineering days; a production-grade Laravel integration with consent mapping, queue delivery, caching, observability, and flag pilot is more realistically 3–5 engineering days plus staging validation. Success criteria should include no material request-latency regression, verified event delivery and idempotency behavior, correct consent-mode enforcement, flag-evaluation parity against fixtures and a real document, and an exercised rollback path.
How can I help you explore Laravel packages today?