PHPackages                             sanderverkuil/posthog-symfony - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. sanderverkuil/posthog-symfony

ActiveSymfony-bundle

sanderverkuil/posthog-symfony
=============================

Symfony integration for PostHog (https://posthog.com)

171PHP

Since Feb 20Pushed 2y ago1 watchersCompare

[ Source](https://github.com/SanderVerkuil/posthog-symfony)[ Packagist](https://packagist.org/packages/sanderverkuil/posthog-symfony)[ RSS](/packages/sanderverkuil-posthog-symfony/feed)WikiDiscussions development Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

 [ ![PostHog](https://camo.githubusercontent.com/a7dfcfff024179f476a804c2861fddfd4e8ca968a046dbf1a90b1f74b38508a8/68747470733a2f2f706f7374686f672e636f6d2f6272616e642f706f7374686f672d6c6f676f2d626c61636b2e706e67) ](https://posthog.com/?utm_source=github&utm_medium=logo)

[![Latest Version on Packagist](https://camo.githubusercontent.com/08c5bd6336775a5ca8a6d0314cfc3526ab56fd9046c5dbd5e94538bc772033cc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616e6465727665726b75696c2f706f7374686f672d73796d666f6e792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sanderverkuil/posthog-symfony)[![Total Downloads](https://camo.githubusercontent.com/f8435056606f5649233c26fbc112935082cb170e43580ad3969bcea5527b9927/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616e6465727665726b75696c2f706f7374686f672d73796d666f6e792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sanderverkuil/posthog-symfony)

Important

This repository and project are not backed by [PostHog](https://posthog.com).

Unofficial PostHog SDK for Symfony
==================================

[](#unofficial-posthog-sdk-for-symfony)

This is the unofficial Symfony SDK for [PostHog](https://posthog.com/).

Getting Started
---------------

[](#getting-started)

Using this `posthog-symfony` SDK provides you with the following benefits:

- Quickly integrate and configure PostHog for your Symfony app
- Out of the box, each event will contain the following data by default
    - The currently authenticated user
    - The Symfony environment

### Install

[](#install)

To install the SDK you will need to be using Composer in your project. To install it please see the [docs](https://getcomposer.org/download/).

```
composer require sanderverkuil/posthog-symfony
```

### Enable the Bundle

[](#enable-the-bundle)

If you installed the package using the Flex recipe, the bundle will be automatically enabled. Otherwise, enable it by adding it to the list of registered bundles in the `Kernel.php` file of your project:

```
class AppKernel extends \Symfony\Component\HttpKernel\Kernel
{
    public function registerBundles(): array
    {
        return [
            // ...
            new \PostHog\PostHogBundle\PostHogBundle(),
        ];
    }

    // ...
}
```

The bundle will be enabled in all environments by default. To enable event reporting, you'll need to add a key (see the next step).

### Configure

[](#configure)

Add the [PostHog key](https://app.posthog.com/products) of your project. Add the key to your `config/packages/posthog.yaml` file.

Keep in mind that by leaving the `key` value empty (or undeclared), you will disable the PostHog integration:.

```
post_hog:
    key: ""
    host: "https://app.posthog.com/" # Or https://eu.posthog.com/ for EU
```

#### Optional: use custom HTTP factory/transport

[](#optional-use-custom-http-factorytransport)

This uses HTTPlug to remain transport-agnostic, you need to install two packages that provide [`php-http/async-client-implementation`](https://packagist.org/providers/php-http/async-client-implementation)and [`psr/http-message-implementation`](https://packagist.org/providers/psr/http-message-implementation).

The suggested packages are:

- the Symfony HTTP Client (`symfony/http-client`)
- Guzzle's message factory (`http-interop/http-factory-guzzle`)

Maintained versions
-------------------

[](#maintained-versions)

- 0.x is actively maintained and developed on the master branch, and uses PostHog SDK 3.0;

Contributing to the SDK
-----------------------

[](#contributing-to-the-sdk)

Please refer to [CONTRIBUTING.md](CONTRIBUTING.md).

License
-------

[](#license)

Licensed under the MIT license, see [`LICENSE`](LICENSE)

### Attributions

[](#attributions)

- I would like to thank [@getsentry](https://github.com/getsentry) for inspiration on how to set up a symfony bundle with regards to general things.
- I would like to thank [@posthog](https://github.com/posthog) for their product.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9654a2b254a95ffe77a3810aa9d42b40c4a1f18dcd2f715f6e98868f63654989?d=identicon)[SanderVerkuil](/maintainers/SanderVerkuil)

---

Top Contributors

[![SanderVerkuil](https://avatars.githubusercontent.com/u/7080527?v=4)](https://github.com/SanderVerkuil "SanderVerkuil (2 commits)")

### Embed Badge

![Health badge](/badges/sanderverkuil-posthog-symfony/health.svg)

```
[![Health](https://phpackages.com/badges/sanderverkuil-posthog-symfony/health.svg)](https://phpackages.com/packages/sanderverkuil-posthog-symfony)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
