Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Clarity Laravel Laravel Package

abr4xas/clarity-laravel

A lightweight Laravel integration for Microsoft Clarity. Configure your Clarity project ID and the package injects the tracking script, with a Blade directive available, so you can add session recordings, heatmaps, and user behavior analytics with minimal setup and no manual snippets.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

clarity-laravel is a thin integration package that wires Microsoft Clarity (session replay, heatmaps, analytics) into a Laravel application — historically by injecting the Clarity JS snippet and exposing a small artisan surface (ClarityCommand) plus publishable config. It is a convenience wrapper, not infrastructure: it sits at the edge of the request lifecycle and has no persistence, queue, or domain-model footprint. That makes it architecturally cheap to adopt and equally cheap to replace with a hand-rolled Blade partial if it ever becomes a liability.

v3.0.0 is a major version with a refactor that is not described in the release notes. Two things matter:

  • ClarityCommand refactor — command class names, signatures, options, or output contracts may have changed. Anything that shells out to this command in CI, deploy scripts, or scheduler entries must be re-verified.
  • "Native buffering" — the release title implies a change to how the Clarity payload is emitted (buffering the response/snippet rather than inline injection). This is the highest-uncertainty item: it may alter when the script reaches the browser, interact with ob_* output buffering, streaming responses, and Laravel Octane's long-lived workers, and it may change config keys.
  • orchestra/testbench ^10.8 → ^11 plus "Laravel 13 maintenance" signals a minimum-version floor raise. Applications on Laravel 10/11 are likely out of support in v3; there is no documented upgrade guide in the notes.

The remaining entries are Dependabot bumps to GitHub Actions (actions/checkout, dependabot/fetch-metadata). These are CI-only and carry no runtime or consumer-facing risk — they should not drive the adoption decision, though checkout 6→7 hints the project's own CI runner assumptions moved.

Technical risk is moderate and concentrated in one place: a major bump with a behavior-changing refactor and no changelog detail. The blast radius is small (a script tag and a command), so the risk is recoverable, not architectural.

Key questions before committing:

  1. What is the supported matrix for v3 — PHP version, Laravel 12 vs 13, Octane compatibility?
  2. What exactly does "native buffering" buffer, and what happens on streamed/StreamedResponse and early-terminated requests?
  3. Were config keys, env var names, or the published config file renamed? Is there a documented v2 → v3 upgrade path?
  4. Did ClarityCommand's signature, name, or exit codes change? Who calls it today?
  5. Does the package still support consent gating / disabling injection per environment, and does it now send anything server-side (a privacy-posture change versus client-only injection)?
  6. Test coverage and maintainer bandwidth — this appears to be a single-maintainer package with dependabot-driven release cadence.

Integration Approach

Stack fit: Good for Blade/server-rendered Laravel apps that already want Clarity and don't want to hand-maintain the snippet. Poor fit for API-only services, SPA front ends served outside Laravel, or teams with a strict third-party-script/CSP posture who will end up wrapping it in their own consent layer anyway.

Migration path: Treat v3 as unproven until validated. Pin ^2 in composer.json on the main branch, and stand up v3 on a short-lived branch. Because the package is edge-of-lifecycle, the migration is a verification exercise, not a rewrite: diff the published config, diff the rendered HTML before/after, and run the command in a scratch environment. If the buffering change only affects emit timing and the config surface is unchanged, the upgrade is a same-day change; if keys moved, it's a config-and-env audit across every environment.

Compatibility: Confirm the Laravel floor against your estate first. If any production app is below the v3 floor, this becomes a per-app staggered upgrade rather than a fleet-wide bump — plan for version skew across services and document which apps are on which major.

Sequencing:

  1. Inventory consumers — which apps require the package, which call ClarityCommand from CI/cron, which gate Clarity by env or consent.
  2. Spike v3 in one low-traffic staging app; capture the rendered output and the command's new behavior.
  3. Verify against Octane if used; verify CSP headers still permit the injected script; verify ad-blocker behavior is unchanged (it will be — but confirm no new first-party endpoint is introduced).
  4. Roll to staging across all consumers, then production behind the existing env toggle (Clarity off in non-prod).
  5. Only then retire the ^2 pin.

Operational Impact

Maintenance: Very low steady-state cost — one config file and a composer constraint. The real cost is release review: this package ships frequently via Dependabot, so someone must triage majors. Budget a recurring 15-minute monthly check rather than a project.

Support: Single-maintainer, small-community project. Assume no vendor SLA. The mitigation is cheap: the integration is small enough to vendor or inline the snippet in under a day if the package stalls or a Laravel major breaks it. Do not let it become load-bearing for anything beyond script injection.

Scaling: Negligible — no runtime overhead beyond response emission, no per-request external calls (assuming buffering stays client-side; confirm). Watch only for interaction with response buffering under high concurrency and with streaming endpoints.

Failure modes:

  • Silent no-op: config cached (config:cache) with a missing/blank project ID, or the service provider not registered — Clarity simply doesn't load and nobody notices. Add a smoke assertion on rendered HTML in staging.
  • Broken command callers: the ClarityCommand refactor breaks CI/cron silently if exit codes changed.
  • Buffering side effects: truncated or duplicated output on streamed responses; Octane worker state leakage if buffering uses static/instance state.
  • Third-party drift: Microsoft changes the Clarity snippet or the CDN is blocked; ad-blockers suppress it for a meaningful share of traffic, so analytics numbers are directional, not authoritative.
  • Compliance: session replay captures DOM and interactions; ensure consent gating and PII masking are configured in Clarity itself, independent of this package.

Ramp-up: A Laravel developer can own this in half a day, including reading the source. The onboarding risk is not skill — it's the undocumented v3 behavior change, which is exactly what the key questions above need to close out.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
andydefer/laravel-notification
adachsoft/cli-process-tester
jhaskell13/laraflow
sebastienheyd/boilerplate-media-manager
ccast/tagixo-primix
pretendtrue/laravel-builder
sawmainek/laravel-scout-tntsearch-driver
tomshaw/laravel-calendar-table
dibakar/laravel-ownership
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo