Skip to content

Add before-send hook support #178

Description

@marandaneto

Summary

Add support for the sdk-spec before-send-hook behavior to the PHP SDK.

Spec

  • sdk-specs/openspec/specs/before-send-hook/spec.md

Current evidence

The SDK audit found no before_send / beforeSend option or callback path in PostHog::init, Client, README, or tests.

Expected behavior

  • Allow configuring a before-send hook for events before enqueue/send.
  • Hook can mutate the assembled event.
  • Hook can drop the event by returning null/equivalent.
  • Hook exceptions should not crash caller code.
  • Add tests covering mutation, drop, and exception handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions