Skip to content

PostHog/posthog-php

Repository files navigation

PostHog PHP

PHP Version CI

Please see the main PostHog docs.

Specifically, the PHP integration details.

Features

  • ✅ Event capture and user identification
  • ✅ Feature flag local evaluation
  • Feature flag dependencies (new!) - Create conditional flags based on other flags
  • ✅ Multivariate flags and payloads
  • ✅ Group analytics
  • ✅ Comprehensive test coverage

Quick Start

  1. Copy .env.example to .env and add your PostHog credentials
  2. Run php example.php to see interactive examples of all features

Questions?

Contributing

  1. Download PHP and Composer
  2. php composer.phar update to install dependencies
  3. bin/test to run tests (this script calls ./vendor/bin/phpunit --verbose test)

Releasing

Releases are semi-automated via GitHub Actions. When a PR with the release and a version bump label is merged to master, the release workflow is triggered.

You'll need an approval from a PostHog engineer. If you're an employee, you can see the request in the #approvals-client-libraries channel.

Release Process

  1. Create your PR with the changes you want to release
  2. Add the release label to the PR
  3. Add a version bump label that should be either bump-patch, bump-minor or bump-major
  4. Merge the PR to master

Once merged, the following happens automatically:

  1. A Slack notification is sent to the client libraries channel requesting approval
  2. A maintainer approves the release in the GitHub Release environment
  3. The version is bumped in lib/PostHog.php and composer.json based on the version label (patch, minor, or major, extracted from the label)
  4. The CHANGELOG.md is updated with a link to the full changelog
  5. Changes are committed and pushed to master
  6. A git tag is created (e.g., v1.8.0)
  7. A GitHub release is created with the changelog content
  8. Slack is notified of the successful release

Releases are installed directly from GitHub.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 28

Languages