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 Posthog Laravel Package

jeffersongoncalves/laravel-posthog

A Laravel integration for PostHog that makes it easy to send analytics events, identify users, and track feature usage from your PHP application through a simple, configurable package API.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Progressive delivery and kill switches. Server-side feature flag evaluation (all flags for a person, single flag value, boolean check, multivariate variants) means you can gate a rollout, dark-launch a feature, or disable a broken path without a deploy. Group support lets you scope flags by organization/team/account rather than only by user — the difference between "roll out to 5% of users" and "roll out to 5% of workspaces."
  • Experimentation. Multivariate variants are the primitive for A/B/n tests; combined with event capture on the same SDK, you get exposure and conversion data in one vendor instead of stitching together a flag tool and an analytics tool.
  • Instrumentation roadmap. Event capture with batch ingestion plus identify/alias covers the core lifecycle: anonymous visitor → signup → identified user → account. alias matters disproportionately for funnel accuracy; getting identity resolution right at instrumentation time is far cheaper than reconciling it later in the warehouse.
  • Build vs. buy on analytics infra. HogQL queries, insights, and session recordings mean you're not building an internal events pipeline, a query layer, and a replay tool. For a team without a dedicated data platform group, this is a credible "buy" — the PM tradeoff is vendor concentration across flags, analytics, and replay rather than three best-of-breed tools.
  • Self-serve product discovery. Session recordings plus HogQL let PMs answer "where do users drop off" and "what did they actually do" without filing a data request. That shortens the loop between observation and a roadmap decision, and it's the strongest argument for the replay capability in a PM's hands specifically.
  • Person lookup by distinct_id supports support/ops workflows and in-product "what plan is this account on" style checks — modest, but it removes a common reason teams keep a second read path into their analytics store.

When to Consider This Package

Adopt when:

  • The product is on Laravel/PHP and you'd otherwise hand-roll an HTTP client against the PostHog API. The PostHogException carrying the original API error body is a genuinely useful detail — it makes ingestion failures debuggable instead of silently swallowed, which is the usual failure mode of homegrown analytics clients.
  • You are already on PostHog, or actively evaluating it and want flags + analytics + replays from one vendor. This package is a reason to consolidate, not a reason to switch.
  • You need server-side flag evaluation (entitlements, pricing tiers, plan gating) where the decision must not be spoofable from the client, or where the client is not a browser.
  • You want batch ingestion to keep analytics calls off the request's critical path via queues.
  • You are comfortable with a 1.0.0, first-release dependency. Semver commitment is a positive signal, but there is no track record, no deprecation history, and a thin community around the package itself.

Look elsewhere or defer when:

  • You are not on Laravel/PHP — there is no reason to route through this wrapper.
  • You need sub-millisecond, high-QPS flag evaluation in a hot path. Nothing here indicates local evaluation or flag caching; server-side calls to the flags endpoint add a network hop and a vendor dependency to your request latency. Confirm caching and fallback behavior with engineering before committing to per-request flag checks.
  • You need data residency / compliance guarantees (EU-only, self-hosted, PII handling, DPA posture). The release notes say nothing about region selection or data handling; that is a discovery item, not an assumption.
  • You need warehouse-native or multi-destination instrumentation (Segment, reverse-ETL, dbt-centric modeling). This couples you to PostHog's storage and query layer via HogQL.
  • You need enterprise support, SLAs, or a large hiring pool familiar with the library. This is a small SDK, not a platform commitment — that belongs in the vendor evaluation for PostHog itself, not this package.

How to Pitch It (Stakeholders)

For executives: This is a low-cost, single-SDK way to get three capabilities we would otherwise build or buy separately — feature flags for controlled rollouts, product analytics, and session recordings. It ships as a 1.0 with a stable API and a predictable upgrade path, so the integration cost is measured in days, not a quarter. The strategic value is decision velocity: PMs can run an experiment, see behavior in recordings and queries, and kill or scale a feature without engineering in the loop. The principal risk is vendor concentration across flags, analytics, and replay, plus the fact that this is a first release with no operational history behind it.

For engineering: It's a thin, conventional Laravel wrapper over the PostHog API rather than a framework of its own. It handles the two auth models correctly — project key in the payload for ingestion, personal API key as a Bearer token for the project API — which is the single most common source of integration bugs when teams wire this up by hand. Batch ingestion fits the queue. Critically, every non-2xx response surfaces as a PostHogException carrying the original API error body, so failures are diagnosable rather than silently dropped; analytics that fails quietly is worse than analytics that fails loudly. Two things to validate before we commit: whether flag evaluation is cached or adds a network hop to request latency, and what the fallback behavior is when PostHog is unreachable. Version is 1.0.0 — first release, clean slate, no migration debt, but also no battle testing.

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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator