Skip to content

Commit 3470e84

Browse files
authored
Myronkaifung quickstart add php (#1333)
* Update install-mixpanel.mdx * Update identify-users.mdx * Update track-events.mdx * Update constants.ts
1 parent 8cfa39f commit 3470e84

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

pages/docs/quickstart/identify-users.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ You may want to disable ip geolocation when using a server-side SDK. You can lea
4747
4848
</Tab>
4949
50+
<Tab>
51+
```shell php
52+
// create/update a profile for user id 12345
53+
$mp->people->set('USER_ID', array(
54+
'$first_name' => "John",
55+
'$last_name' => "Doe",
56+
'$email' => "[email protected]",
57+
'$phone' => "5555555555",
58+
"Favorite Color" => "red"
59+
));
60+
````
61+
62+
You may want to disable ip geolocation when using a server-side SDK. You can learn more in [Server-Side Best Practices](/docs/tracking-best-practices/server-side-best-practices)
63+
64+
</Tab>
65+
5066
<Tab>
5167
```javascript
5268
mixpanel.people.set('USER_ID', {

pages/docs/quickstart/install-mixpanel.mdx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,39 @@ mp = Mixpanel("YOUR_TOKEN")
8080
````
8181
</Tab>
8282

83+
<Tab>
84+
##### Install the SDK
85+
86+
**Install with Composer**
87+
88+
1. Add mixpanel/mixpanel-php as a dependency and run composer update:
89+
90+
```shell php
91+
"require": {
92+
...
93+
"mixpanel/mixpanel-php" : "2.*"
94+
...
95+
}
96+
```
97+
**Install Manually**
98+
99+
1. [Download the Mixpanel PHP Library](https://github.com/mixpanel/mixpanel-php/archive/master.zip)
100+
2. Extract the zip file to a directory called "mixpanel-php" in your project root
101+
102+
##### Configure the SDK
103+
Replace `YOUR_TOKEN` with your project token. You can find your token [here](https://mixpanel.com/settings/project).
104+
```shell php
105+
<?php
106+
// import Mixpanel
107+
require 'mixpanel-php/lib/Mixpanel.php';
108+
109+
// get the Mixpanel class instance, replace with your project token
110+
$mp = Mixpanel::getInstance("YOUR_TOKEN");
111+
112+
?>
113+
````
114+
</Tab>
115+
83116
<Tab>
84117
##### Install the SDK
85118
```shell Node.js

pages/docs/quickstart/track-events.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ _ Github: [Browse the Open Source SDKs](https://github.com/mixpanel)
5050

5151
</Tab>
5252

53+
<Tab>
54+
```shell php
55+
$mp->track("button clicked", array("label" => "sign-up"));
56+
```
57+
58+
🎉 Congratulations, you've tracked your first event! You can see it in Mixpanel via the [Events page](https://mixpanel.com/report/events).
59+
60+
**More resources:**
61+
_ Docs: [Read the Python SDK Doc](/docs/tracking-methods/sdks/php/)
62+
_ Github: [Browse the Open Source SDKs](https://github.com/mixpanel)
63+
64+
</Tab>
65+
5366
<Tab>
5467
```js Node.js
5568
// Note: you must supply the USER_ID

utils/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const dataItems = {
22
'javascript': `Javascript`,
33
'python': `Python`,
4+
'php': `PHP`,
45
'node': `Node`,
56
'go': `Go`,
67
'ruby': `Ruby`,

0 commit comments

Comments
 (0)