Please see the main PostHog docs.
SDK usage examples and code snippets live in the official documentation so they stay up to date.
- PHP library docs
- Laravel integration docs
- Upgrade notes, including GeoIP configuration and compatibility
The optional PostHog\OpenTelemetry\ContextSpanProcessor adds session and person IDs to application spans inside this client's request context. Register it on the application's existing OpenTelemetry provider. OpenTelemetry remains an optional application dependency.
A client with no project key keeps request context but adds no span attributes. A valid-key client with the noop consumer still adds them.
The registered processor also enables request span enrichment when withContext() starts. This lookup skips Fibers because uninitialized OpenTelemetry Fiber storage can return another execution path's span. Child spans still use the active Fiber's PostHog context. New Fibers and queue jobs need explicit context propagation.
Existing span attributes take precedence. The processor preserves the application's provider, sampling, and exporters. See the PHP tracing guide and Laravel guide for setup.
See CONTRIBUTING.md for local setup and test instructions.
See RELEASING.md.