posthog/posthog-php
PostHog PHP SDK for server-side product analytics: capture events, identify users, group accounts, evaluate feature flags, and send data to PostHog from Laravel or plain PHP applications.
subscription_created, invoice_paid, seat_provisioned, report_exported — are invisible or duplicated. This SDK lets the Laravel backend emit those events with the same distinct_id the frontend uses, so the funnel actually closes.group_identify, company properties) underpins seat-expansion, account-health, and churn-risk reporting. Backend systems know the account hierarchy; the frontend usually doesn't.Consider it when:
flush() on shutdown, distinct_id handling) rather than reimplementing them.Look elsewhere when:
posthog-js is the right tool; this package adds nothing there.Executives: PostHog's official PHP SDK lets our backend emit the events that actually drive revenue — payments, subscriptions, provisioning — under the same identity model as our frontend analytics. That closes the gap between "someone clicked" and "someone paid," and gives us server-side feature flags so we can ship behind a switch without a redeploy. MIT-licensed, officially maintained, no new vendor and no procurement.
Engineering: It's a thin, vendor-maintained client, not a framework. Two real costs: (1) it introduces batching and flush-on-shutdown behavior you have to reason about in long-running processes, and (2) it is infrastructure we do not own. Mitigate both by wrapping it behind our own Analytics interface — that keeps the vendor swappable and gives us one chokepoint for PII scrubbing and event-schema validation. Rough effort: 1–2 days for the adapter plus 5–8 key events; another day for flags including caching.
State the caveats plainly: low star count and thin community surface; feature parity with the JS SDK typically lags; the release date in the metadata warrants verification. None of these are blockers for a wrapped dependency — but they are reasons to pin the version, keep it out of domain code, and avoid betting an entire analytics migration on it in one quarter.
How can I help you explore Laravel packages today?