diff --git a/.gitignore b/.gitignore index 5490473..f6790eb 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,4 @@ *.log *.lock *.idea -vendor +/vendor diff --git a/composer.json b/composer.json index 5d43e7a..5da3697 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,9 @@ { "name": "mixpanel/mixpanel-php", "description": "The Official PHP library for Mixpanel", + "type": "library", + "minimum-stability": "stable", + "prefer-stable": true, "keywords": [ "mixpanel", "mixpanel php" @@ -17,13 +20,27 @@ } ], "require": { - "php": ">=5.0" + "ext-json": "*", + "ext-curl": "*", + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "5.6.*", + "phpunit/phpunit": "^7.0", "phpdocumentor/phpdocumentor": "2.9.*" }, "autoload": { - "files": ["lib/Mixpanel.php"] + "psr-4": { + "Mixpanel\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Mixpanel\\Test\\": "test/" + } + }, + "config": { + "allow-plugins": { + "symfony/flex": false + } } } diff --git a/docs/build/phpdoc-cache-03/phpdoc-cache-file_d24c245cf2947c71b8442fb733e9e019.dat b/docs/build/phpdoc-cache-03/phpdoc-cache-file_d24c245cf2947c71b8442fb733e9e019.dat new file mode 100644 index 0000000..ce66538 Binary files /dev/null and b/docs/build/phpdoc-cache-03/phpdoc-cache-file_d24c245cf2947c71b8442fb733e9e019.dat differ diff --git a/docs/build/phpdoc-cache-10/phpdoc-cache-file_a79b0901d71e0f647bbbe2e32a61b361.dat b/docs/build/phpdoc-cache-10/phpdoc-cache-file_a79b0901d71e0f647bbbe2e32a61b361.dat new file mode 100644 index 0000000..f3fba04 Binary files /dev/null and b/docs/build/phpdoc-cache-10/phpdoc-cache-file_a79b0901d71e0f647bbbe2e32a61b361.dat differ diff --git a/docs/build/phpdoc-cache-2e/phpdoc-cache-settings.dat b/docs/build/phpdoc-cache-2e/phpdoc-cache-settings.dat new file mode 100644 index 0000000..3a83f54 Binary files /dev/null and b/docs/build/phpdoc-cache-2e/phpdoc-cache-settings.dat differ diff --git a/docs/build/phpdoc-cache-4d/phpdoc-cache-file_6eb396ad4f17f85bdace747d12079c51.dat b/docs/build/phpdoc-cache-4d/phpdoc-cache-file_6eb396ad4f17f85bdace747d12079c51.dat new file mode 100644 index 0000000..97e1da7 Binary files /dev/null and b/docs/build/phpdoc-cache-4d/phpdoc-cache-file_6eb396ad4f17f85bdace747d12079c51.dat differ diff --git a/docs/build/phpdoc-cache-5c/phpdoc-cache-file_f12be636472228ca0dffbaa420e12b68.dat b/docs/build/phpdoc-cache-5c/phpdoc-cache-file_f12be636472228ca0dffbaa420e12b68.dat new file mode 100644 index 0000000..1beff46 Binary files /dev/null and b/docs/build/phpdoc-cache-5c/phpdoc-cache-file_f12be636472228ca0dffbaa420e12b68.dat differ diff --git a/docs/build/phpdoc-cache-6a/phpdoc-cache-file_34ad14a55f301b2c1b01737f818b9278.dat b/docs/build/phpdoc-cache-6a/phpdoc-cache-file_34ad14a55f301b2c1b01737f818b9278.dat new file mode 100644 index 0000000..9f996b9 Binary files /dev/null and b/docs/build/phpdoc-cache-6a/phpdoc-cache-file_34ad14a55f301b2c1b01737f818b9278.dat differ diff --git a/docs/build/phpdoc-cache-91/phpdoc-cache-file_3916995003afda92992b0b702e908de0.dat b/docs/build/phpdoc-cache-91/phpdoc-cache-file_3916995003afda92992b0b702e908de0.dat new file mode 100644 index 0000000..0c3dfa6 Binary files /dev/null and b/docs/build/phpdoc-cache-91/phpdoc-cache-file_3916995003afda92992b0b702e908de0.dat differ diff --git a/docs/build/phpdoc-cache-9f/phpdoc-cache-file_dcfc7f8ba41f2ed3e5967d030ded64d7.dat b/docs/build/phpdoc-cache-9f/phpdoc-cache-file_dcfc7f8ba41f2ed3e5967d030ded64d7.dat new file mode 100644 index 0000000..ad2be9e Binary files /dev/null and b/docs/build/phpdoc-cache-9f/phpdoc-cache-file_dcfc7f8ba41f2ed3e5967d030ded64d7.dat differ diff --git a/docs/build/phpdoc-cache-a3/phpdoc-cache-file_d289a5d50a11fdbea7ef5168efcddd00.dat b/docs/build/phpdoc-cache-a3/phpdoc-cache-file_d289a5d50a11fdbea7ef5168efcddd00.dat new file mode 100644 index 0000000..08785c4 Binary files /dev/null and b/docs/build/phpdoc-cache-a3/phpdoc-cache-file_d289a5d50a11fdbea7ef5168efcddd00.dat differ diff --git a/docs/build/phpdoc-cache-b7/phpdoc-cache-file_43ddd34d00b567ff639f5887b3b5e954.dat b/docs/build/phpdoc-cache-b7/phpdoc-cache-file_43ddd34d00b567ff639f5887b3b5e954.dat new file mode 100644 index 0000000..3f18dc5 Binary files /dev/null and b/docs/build/phpdoc-cache-b7/phpdoc-cache-file_43ddd34d00b567ff639f5887b3b5e954.dat differ diff --git a/docs/build/phpdoc-cache-db/phpdoc-cache-file_8254b68fa0f2b7492ef026441398c792.dat b/docs/build/phpdoc-cache-db/phpdoc-cache-file_8254b68fa0f2b7492ef026441398c792.dat new file mode 100644 index 0000000..7cfb1eb Binary files /dev/null and b/docs/build/phpdoc-cache-db/phpdoc-cache-file_8254b68fa0f2b7492ef026441398c792.dat differ diff --git a/docs/classes/Base_MixpanelBase.html b/docs/classes/Mixpanel.Base.Base.html similarity index 75% rename from docs/classes/Base_MixpanelBase.html rename to docs/classes/Mixpanel.Base.Base.html index 39bfb63..01a4266 100644 --- a/docs/classes/Base_MixpanelBase.html +++ b/docs/classes/Mixpanel.Base.Base.html @@ -24,7 +24,7 @@ + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ + + +

\Mixpanel\ProducersGroupsProducer

+

Provides an API to create/update group profiles on Mixpanel

+ + + +
+

Summary

+
+
+ Methods +
+
+ Properties +
+
+ Constants +
+
+
+
+ __construct()
+ __destruct()
+ flush()
+ reset()
+ getQueue()
+ getToken()
+ enqueue()
+ enqueueAll()
+ _getEndpoint()
+ set()
+ setOnce()
+ remove()
+ union()
+ deleteGroup()
+
+
+ No public properties found +
+
+ No constants found +
+
+
+
+ _getConsumer()
+ _persist()
+ _log()
+ _debug()
+
+
+ $_token
+ $_max_queue_size
+ $_options
+
+
+ N/A +
+
+
+
+ _constructPayload()
+
+
+ $_queue
+ $_consumer
+ $_consumers
+ $_defaults
+
+
+ N/A +
+
+
+
+ +
+ + + +
+
+

Properties

+
+ +
+ +
+
+ +
+

$_token

+
$_token : string
+

+ + +

Type

+ string + — a token associated to a Mixpanel project
+
+ +
+ +
+
+ +
+

$_max_queue_size

+
$_max_queue_size : integer
+

If the queue reaches this size we'll auto-flush to prevent out of memory errors

+ + +

Type

+ integer +
+
+ +
+ +
+
+ +
+

$_options

+
$_options : array
+

An array of options to be used by the Mixpanel library.

+ + +

Type

+ array +
+
+ +
+ +
+
+ +
+

$_queue

+
$_queue : array
+

+ + +

Type

+ array + — a queue to hold messages in memory before flushing in batches
+
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+

$_consumers

+
$_consumers : array
+

+ + +

Type

+ array + — The list of available consumers
+
+ +
+ +
+
+ +
+

$_defaults

+
$_defaults : array
+

Default options that can be overridden via the $options constructor arg

+ + +

Type

+ array +
+
+ +
+ + + +
+

Methods

+ +
+ +
+
+ +
+

__construct()

+ +
__construct(array  $options = array()) 
+

Construct a new MixpanelBase object and merge custom options with defaults

+ + +

Parameters

+ + + + + + +
array$options
+ + + +
+
+ +
+ +
+
+ +
+

__destruct()

+ +
__destruct() 
+

Flush the queue when we destruct the client with retries

+ + + + + +
+
+ +
+ +
+
+ +
+

flush()

+ +
flush(integer  $desired_batch_size = 50) : boolean
+

Iterate the queue and write in batches using the instantiated Consumer Strategy

+ + +

Parameters

+ + + + + + +
integer$desired_batch_size
+ + +

Returns

+ boolean + —

whether or not the flush was successful

+ +
+
+ +
+ +
+
+ +
+

reset()

+ +
reset() 
+

Empties the queue without persisting any of the messages

+ + + + + +
+
+ +
+ +
+
+ +
+

getQueue()

+ +
getQueue() : array
+

Returns the in-memory queue

+ + + + +

Returns

+ array + +
+
+ +
+ +
+
+ +
+

getToken()

+ +
getToken() : string
+

Returns the current Mixpanel project token

+ + + + +

Returns

+ string + +
+
+ +
+ +
+
+ +
+

enqueue()

+ +
enqueue(array  $message = array()) 
+

Add an array representing a message to be sent to Mixpanel to a queue.

+ + +

Parameters

+ + + + + + +
array$message
+ + + +
+
+ +
+ +
+
+ +
+

enqueueAll()

+ +
enqueueAll(array  $messages = array()) 
+

Add an array representing a list of messages to be sent to Mixpanel to a queue.

+ + +

Parameters

+ + + + + + +
array$messages
+ + + +
+
+ +
+ +
+
+ +
+

_getEndpoint()

+ +
_getEndpoint() : string
+

Returns the "groups" endpoint

+ + + + +

Returns

+ string + +
+
+ +
+ +
+
+ +
+

set()

+ +
set(string|integer  $group_key, string|integer  $group_id, array  $props, boolean  $ignore_time = false) 
+

Set properties on a group profile. If the group profile does not exist, it creates it with these properties.

+

If it does exist, it sets the properties to these values, overwriting existing values.

+ +

Parameters

+ + + + + + + + + + + + + + + + + + + + + +
string|integer$group_key

the group_key used for groups in Project Settings

string|integer$group_id

the group id used for the group profile

array$props

associative array of properties to set on the group profile

boolean$ignore_time

If the $ignore_time property is true, Mixpanel will not automatically update the "Last Seen" property of the group profile. Otherwise, Mixpanel will add a "Last Seen" property associated with the current time

+ + + +
+
+ +
+ +
+
+ +
+

setOnce()

+ +
setOnce(string|integer  $group_key, string|integer  $group_id, array  $props, boolean  $ignore_time = false) 
+

Set properties on a group profile. If the Group profile does not exist, it creates it with these properties.

+

If it does exist, it sets the properties to these values but WILL NOT overwrite existing values.

+ +

Parameters

+ + + + + + + + + + + + + + + + + + + + + +
string|integer$group_key

the group_key used for groups in Project Settings

string|integer$group_id

the group id used for the group profile

array$props

associative array of properties to set on the group profile

boolean$ignore_time

If the $ignore_time property is true, Mixpanel will not automatically update the "Last Seen" property of the group profile. Otherwise, Mixpanel will add a "Last Seen" property associated with the current time

+ + + +
+
+ +
+ +
+
+ +
+

remove()

+ +
remove(string|integer  $group_key, string|integer  $group_id, array  $props, boolean  $ignore_time = false) 
+

Unset properties on a group profile. If the group does not exist, it creates it with no properties.

+

If it does exist, it unsets these properties. NOTE: In other libraries we use 'unset' which is +a reserved word in PHP.

+ +

Parameters

+ + + + + + + + + + + + + + + + + + + + + +
string|integer$group_key

the group_key used for groups in Project Settings

string|integer$group_id

the group id used for the group profile

array$props

associative array of properties to unset on the group profile

boolean$ignore_time

If the $ignore_time property is true, Mixpanel will not automatically update the "Last Seen" property of the group profile. Otherwise, Mixpanel will add a "Last Seen" property associated with the current time

+ + + +
+
+ +
+ +
+
+ +
+

union()

+ +
union(string|integer  $group_key, string|integer  $group_id, string  $prop, string|array  $val, boolean  $ignore_time = false) 
+

Adds $val to a list located at $prop. If the property does not exist, it will be created. If $val is a string +and the list is empty or does not exist, a new list with one value will be created.

+ + +

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
string|integer$group_key

the group_key used for groups in Project Settings

string|integer$group_id

the group id used for the group profile

string$prop

the property that holds the list

string|array$val

items to add to the list

boolean$ignore_time

If the $ignore_time property is true, Mixpanel will not automatically update the "Last Seen" property of the group profile. Otherwise, Mixpanel will add a "Last Seen" property associated with the current time

+ + + +
+
+ +
+ +
+
+ +
+

deleteGroup()

+ +
deleteGroup(string|integer  $group_key, string|integer  $group_id, boolean  $ignore_time = false) 
+

Delete this group profile from Mixpanel

+ + +

Parameters

+ + + + + + + + + + + + + + + + +
string|integer$group_key

the group_key used for groups in Project Settings

string|integer$group_id

the group id used for the group profile

boolean$ignore_time

If the $ignore_time property is true, Mixpanel will not automatically update the "Last Seen" property of the profile. Otherwise, Mixpanel will add a "Last Seen" property associated with the current time

+ + + +
+
+ +
+ +
+
+ + +
+ +
+ +
+
+ +
+

_persist()

+ +
_persist(  $message) : mixed
+

Given an array of messages, persist it with the instantiated Persistence Strategy

+ + +

Parameters

+ + + + + + +
$message
+ + +

Returns

+ mixed + +
+
+ +
+ +
+
+ +
+

_log()

+ +
_log(  $msg) 
+

Log a message to PHP's error log

+ + +

Parameters

+ + + + + + +
$msg
+ + + +
+
+ +
+ +
+
+ +
+

_debug()

+ +
_debug() : boolean
+

Returns true if in debug mode, false if in production mode

+ + + + +

Returns

+ boolean + +
+
+ +
+ +
+
+ +
+

_constructPayload()

+ +
_constructPayload(  $group_key,   $group_id,   $operation,   $value, boolean  $ignore_time = false) : array
+

Internal method to prepare a message given the message data

+ + +

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
$group_key
$group_id
$operation
$value
boolean$ignore_time

If the $ignore_time property is true, Mixpanel will not automatically update the "Last Seen" property of the group Profile. Otherwise, Mixpanel will add a "Last Seen" property associated with the current time

+ + +

Returns

+ array + +
+
+ +
+ +
+
+ + + + +
+ + + diff --git a/docs/classes/Producers_MixpanelPeople.html b/docs/classes/Mixpanel.Producers.PeopleProducer.html similarity index 82% rename from docs/classes/Producers_MixpanelPeople.html rename to docs/classes/Mixpanel.Producers.PeopleProducer.html index 42d3640..5c81a03 100644 --- a/docs/classes/Producers_MixpanelPeople.html +++ b/docs/classes/Mixpanel.Producers.PeopleProducer.html @@ -24,7 +24,7 @@ + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ + + +

ProducersGroupsProducer.php

+

+ + + + +

Classes

+ + + + + +
GroupsProducerProvides an API to create/update group profiles on Mixpanel
+
+ + +
+ + + +
+
+ + + + +
+ + + diff --git a/docs/files/Producers.MixpanelPeople.html b/docs/files/Producers.PeopleProducer.html similarity index 67% rename from docs/files/Producers.MixpanelPeople.html rename to docs/files/Producers.PeopleProducer.html index e6c919a..86e5247 100644 --- a/docs/files/Producers.MixpanelPeople.html +++ b/docs/files/Producers.PeopleProducer.html @@ -24,7 +24,7 @@ + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ +

\MixpanelBase

+ + + + +

Classes

+ + + + + +
BaseThis a Base class which all Mixpanel classes extend from to provide some very basic +debugging and logging functionality. It also serves to persist $_options across the library.
+
+ + +
+ + + +
+
+ + +
+ + + diff --git a/docs/namespaces/Mixpanel.ConsumerStrategies.html b/docs/namespaces/Mixpanel.ConsumerStrategies.html new file mode 100644 index 0000000..b824154 --- /dev/null +++ b/docs/namespaces/Mixpanel.ConsumerStrategies.html @@ -0,0 +1,290 @@ + + + + + + API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ +

\MixpanelConsumerStrategies

+ + + + +

Classes

+ + + + + + + + + + + + + + + + + +
AbstractConsumerProvides some base methods for use by a Consumer implementation
CurlConsumerConsumes messages and sends them to a host/endpoint using cURL
FileConsumerConsumes messages and writes them to a file
SocketConsumerConsumes messages and writes them to host/endpoint using a persistent socket
+
+ + +
+ + + +
+
+ + +
+ + + diff --git a/docs/namespaces/Mixpanel.Producers.html b/docs/namespaces/Mixpanel.Producers.html new file mode 100644 index 0000000..9170e58 --- /dev/null +++ b/docs/namespaces/Mixpanel.Producers.html @@ -0,0 +1,290 @@ + + + + + + API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ +

\MixpanelProducers

+ + + + +

Classes

+ + + + + + + + + + + + + + + + + +
BaseProducerProvides some base methods for use by a message Producer
EventsProducerProvides an API to track events on Mixpanel
GroupsProducerProvides an API to create/update group profiles on Mixpanel
PeopleProducerProvides an API to create/update profiles on Mixpanel
+
+ + +
+ + + +
+
+ + +
+ + + diff --git a/docs/namespaces/Mixpanel.html b/docs/namespaces/Mixpanel.html new file mode 100644 index 0000000..3cffed5 --- /dev/null +++ b/docs/namespaces/Mixpanel.html @@ -0,0 +1,289 @@ + + + + + + API Documentation + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+ +

\Mixpanel

+ +

Namespaces

+ + + + + + + + + + +
Base
ConsumerStrategies
Producers
+ + + +

Classes

+ + + + + +
MixpanelThis is the main class for the Mixpanel PHP Library which provides all of the methods you need to track events, +create/update profiles and group profiles.
+
+ + +
+ + + +
+
+ + +
+ + + diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index 785ee1a..07b46b9 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -39,6 +39,14 @@