Download the PHP package jeffersongoncalves/laravel-posthog without Composer
On this page you can find all versions of the php package jeffersongoncalves/laravel-posthog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jeffersongoncalves/laravel-posthog
More information about jeffersongoncalves/laravel-posthog
Files in jeffersongoncalves/laravel-posthog
Package laravel-posthog
Short Description PHP/Laravel client for the PostHog API: event capture, batch ingestion, feature flags, persons and HogQL queries.
License MIT
Homepage https://github.com/jeffersongoncalves/laravel-posthog
Informations about the package laravel-posthog
Laravel PostHog
A PHP/Laravel client for PostHog. Capture events, batch ingestion, identify people, evaluate feature flags and read back persons, insights, session recordings and HogQL queries — through a simple, typed API built on Laravel's Http client. Works with PostHog Cloud (US/EU) and self-hosted instances.
Features
- Event capture: single events and batched ingestion
- Person identification:
$identifyand$create_aliashelpers over the capture endpoint - Feature flags: read every flag for a person, a single flag value (including multivariate variants), or a simple boolean check
- Persons: look people up by
distinct_id - HogQL: run SQL-like queries against your event data
- Insights and session recordings: list them from the project API
- Handles PostHog's two auth models for you — the public project API key in the payload for ingestion, the personal API key as a Bearer token for reads
- Throws
PostHogException(with the original API error body) on any non-2xx response
Installation
You can install the package via composer:
Publish the config file:
Then set your credentials:
POSTHOG_PROJECT_API_KEY is the public write-only key and is all you need for capture, batch and feature flags. POSTHOG_PERSONAL_API_KEY plus POSTHOG_PROJECT_ID are only required for the read endpoints (persons, HogQL, insights, session recordings).
Configuration
Usage
The package is resolved via the PostHog facade or by injecting JeffersonGoncalves\PostHog\PostHog.
Capturing events
Batching events
Identifying people
Feature flags
Group-based flags are supported by passing the groups map:
Persons
HogQL queries
Insights and session recordings
Error handling
Any non-2xx API response throws JeffersonGoncalves\PostHog\Exceptions\PostHogException, which exposes the decoded error body:
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Jefferson Gonçalves
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-posthog with dependencies
illuminate/http Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
spatie/laravel-package-tools Version ^1.16