mirafive/sdk-laravel
A Laravel SDK package that wraps Mirafive services in Laravel-native conventions, providing a service provider, facade, and publishable configuration so you can integrate Mirafive features into your app with minimal setup and fluent, expressive calls.
mirafive/sdk-php: buffer events in the request, flush on terminate / Octane request end / task / tick / queued job. That's the decision point for "how do we collect product events without paying latency on every request" — it answers it with a queue-backed hand-off (MIRAFIVE_QUEUE, SendBatch) and a synchronous escape hatch (send()).Event::listen + HTTP client + retry logic, this is a cheap buy: composer require, auto-discovered provider, publishable config. If the alternative is a full CDP (Segment, PostHog, RudderStack), this is a narrower commitment and should be scoped as such.MiraFlags + cache-shared flag document + @mirafiveFlags($unit) bootstrap block supports gating features per unit/tenant without a second vendor. This is what lets a PM ship behind flags rather than behind a release train.enabled false or no secret key) means nothing leaves the process and no key is required — useful for local, CI, and self-hosted deployments. Separate mode (server events) and script_mode (tracker tag, default consentless) is a genuine product lever: you can run server-side collection while holding back the client tag, or vice versa.Mira::forUser($user) and Mira::optedOut($request) mean the "who is this event about" and "did they say no" decisions are encoded in one place rather than sprinkled across controllers. That directly affects data-quality and compliance reporting.Cache-Control: private, no-store, flag work and event work can be sequenced independently — pick one, prove it, then turn on the other.php artisan mirafive:check sending $install_check and printing a receipt is a shippable verification step for a go-live checklist. Combined with Mira::fake() and its assertions (assertTracked, assertNotTracked, assertIdentified, assertNothingTracked), event instrumentation becomes testable in CI rather than trusted by eyeball.Consider it when:
mirafive/sdk-php or elsewhere.optedOut(), gives you a defensible default without building a consent layer.Look elsewhere or defer when:
mode, script_mode, MIRAFIVE_QUEUE) are the most likely places for breaking changes.script_mode: consentless by default is a red flag until reviewed. Ship the default only after legal/privacy sign-off; plan to switch to a consent-gated mode for regulated traffic.For executives (one paragraph): We can add product analytics and feature flags to the Laravel application with one dependency and a single config file. It is off by default and safe by default: with no key configured it sends nothing and breaks nothing, and it has an explicit opt-out path per user, which is the part auditors ask about. It runs collection off the request path via the queue, so page performance does not regress, and it ships with a self-test command plus a testing harness so we can verify instrumentation in CI rather than discovering gaps post-launch. Cost is a vendor commitment to MiraFive and acceptance of v1.0.0 maturity risk.
For engineering (the practical summary): composer require mirafive/sdk-laravel, provider and Mira facade auto-discovered, php artisan vendor:publish --tag=mirafive-config to get config/mirafive.php. Buffers flush on terminate, after each Octane request, task, tick, and queued job; flags are warmed under Octane and shared via a cache store — so pick a real shared cache backend. Set MIRAFIVE_QUEUE to hand off encoded batches to SendBatch for byte-for-byte worker delivery with its own key; send() stays synchronous for cases where you need it. Views get @mirafiveScript (hosted tracker with website key and Vite CSP nonce) and @mirafiveFlags($unit) (bootstrap block, served private, no-store — expect it to bypass CDN caching). Use Mira::fake() and the assert helpers in tests, and php artisan mirafive:check in the deploy checklist.
The trade-off to state plainly: this is a first release of a wrapper around a first major of the underlying SDK. Expect config and API churn, and treat the consentless default tracker mode as something to consciously approve rather than inherit.
How can I help you explore Laravel packages today?