forked from PostHog/posthog-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
52 lines (42 loc) · 1.4 KB
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once __DIR__ . '/vendor/autoload.php';
use PostHog\PostHog;
const PROJECT_API_KEY = "";
const PERSONAL_API_KEY = "";
PostHog::init(
PROJECT_API_KEY,
array('host' => 'https://app.posthog.com'),
null,
PERSONAL_API_KEY
);
# Capture an event
PostHog::capture(
[
'distinctId' => 'distinct_id',
'event' => 'event',
'properties' => [
'property1' => 'value',
'property2' => 'value',
],
'sendFeatureFlags' => true
]
);
PostHog::capture(
[
'distinctId' => 'distinct_id',
'event' => 'event',
'properties' => [
'property1' => 'value',
'property2' => 'value',
],
'sendFeatureFlags' => false
]
);
PostHog::isFeatureEnabled("multivariate-test", "distinct-id", false);
PostHog::isFeatureEnabled("multivariate-test", "distinct-id", false, ['company' => ['id' => 5]]);
PostHog::getFeatureFlag("simple-test", "distinct-id", false);
PostHog::getFeatureFlag("simple-test", "distinct-id", false, ['company' => ['id' => 5]]);
PostHog::getFeatureFlag("multivariate-test", "distinct-id", false);
PostHog::getFeatureFlag("multivariate-test", "distinct-id", false, ['company' => ['id' => 5]]);
PostHog::getFeatureFlag("multivariate-simple-test", "distinct-id", false);
PostHog::getFeatureFlag("multivariate-simple-test", "distinct-id", false, ['company' => ['id' => 5]]);