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

Laravel Hotjar Laravel Package

jeffersongoncalves/laravel-hotjar

Integrates Hotjar tracking into Laravel applications, letting you inject the Hotjar snippet and configure your site ID from a single config file. Simple to install and works with any Blade or Livewire app.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. The package is a Laravel-side script emitter: it injects <script> tags into rendered responses (widgets, embeds, analytics, or third-party integrations). That places it squarely in the presentation layer, typically registered through a service provider and hooked into Blade rendering or middleware. Fit is good for teams already on a standard Laravel request lifecycle; there is no new infrastructure to run.

Integration feasibility. Release 1.1.0 adds retrieval of Laravel's Vite CSP nonce and applies it to every <script> the package emits. This is a small, additive change: it requires no new configuration, no new dependency, and no schema work. It composes with laravel-security-headers or any app that calls Vite::useCspNonce(). Integration effort is effectively zero for apps that already set a nonce, and a non-event for apps that do not.

Technical risk. Low. The material risk is not the nonce logic itself but the coupling it implies: the package now reads shared state (Vite::cspNonce()) at render time, so correctness depends on nonce generation happening before the package renders. If the package emits scripts from a middleware that runs ahead of the nonce-setting middleware, the nonce will be null and the browser will silently block the script — a failure mode that is invisible server-side and only appears as a CSP violation in the browser console. Second-order risk: nonce reuse across responses would weaken the policy; that is Laravel's responsibility, not the package's, but it is worth confirming.

Key questions.

  • Which middleware/render hook does the package use, and where does it sit relative to Vite::useCspNonce() in the stack?
  • Does the package fail loudly (log/exception) when a nonce is present on the response but missing from an emitted script, or fail silently?
  • Are inline event handlers or eval-style constructs used anywhere, which a strict script-src would still block regardless of nonce?
  • Does the package set src attributes to same-origin/allowlisted hosts, or can it emit arbitrary third-party origins?
  • What is the package's maintenance cadence and Laravel version support matrix (10/11/12)?
  • Is there a documented fallback for apps using hash-based or strict-dynamic policies?

Integration Approach

Stack fit. Assumes Laravel 10+ with the default Vite integration. No incompatibility with Blade, Livewire, or Inertia — the emitted tag is origin-agnostic as long as rendering happens through Laravel's response pipeline. Apps that render HTML outside Laravel (separate Node SSR service, static prebuild) will not get nonces on those paths.

Migration path. Purely additive. 1.0.x → 1.1.0 requires no code changes; behavior is unchanged for apps without a nonce. For apps currently relying on 'unsafe-inline' in script-src, this release is the enabler for tightening the policy — but the policy change should be a separate, deliberate step, not bundled with the package upgrade.

Compatibility. Verify the Laravel version floor: Vite::useCspNonce() and Vite::cspNonce() availability has shifted across minor versions, and the package may now implicitly require a newer framework than it declares. Also check compatibility with laravel-security-headers and any CSP middleware that rewrites headers after the response is built — ordering matters.

Sequencing.

  1. Upgrade the package in a non-production environment with CSP in report-only mode.
  2. Confirm nonces appear on all package-emitted scripts across every route that renders them (including error pages and authenticated layouts).
  3. Verify middleware ordering so nonce generation precedes package rendering.
  4. Move CSP from report-only to enforce, watching for violations over a full traffic cycle (including edge cases like cached pages).
  5. Only then remove 'unsafe-inline'.

Operational Impact

Maintenance. Minimal ongoing cost — this is a passive, dependency-free feature. The real maintenance surface is the CSP policy itself and the coordination between the package, Vite, and whichever header middleware is in use. Pin the package version and review release notes for future changes to nonce handling, since that code path is now security-relevant.

Support. Support burden shifts toward the platform/security team rather than application developers. Expect questions of the form "the widget doesn't load in staging," whose answer is almost always a CSP or nonce-ordering issue. Document the nonce dependency in the runbook.

Scaling. No scaling implications — nonce retrieval is an in-memory read. Caution: if responses are cached at the CDN or via Laravel's response cache, a cached page will carry a stale nonce that no longer matches the per-response header. Any full-page caching layer must either bypass nonce-bearing routes or strip/reinject nonces at the edge. This is the most likely operational surprise.

Failure modes.

  • Silent script blocking: nonce missing or mismatched → script dropped, feature silently broken, no server-side signal.
  • Cache-induced nonce staleness: full-page cache serves a nonce that doesn't match the header.
  • Middleware ordering: nonce not yet set when the package renders.
  • Incomplete coverage: third-party scripts injected outside the package still lack nonces, so 'unsafe-inline' cannot actually be removed yet.
  • Overly permissive policy: if the emitted scripts point at external origins, script-src still needs those hosts allowlisted.

Ramp-up. Near-zero for developers — no new API to learn. The learning curve sits with whoever owns the CSP configuration: they need to understand nonce generation, middleware ordering, and caching interaction. Budget a short enablement session with the security/platform owner, and instrument CSP violation reporting before enforcing.

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.
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk