Segment_Client::__construct PHP Method

__construct() public method

Create a new analytics object with your app's secret key
public __construct ( string $secret, array $options = [] )
$secret string
$options array array of consumer options [optional]
    public function __construct($secret, $options = array())
    {
        $consumers = array("socket" => "Segment_Consumer_Socket", "file" => "Segment_Consumer_File", "fork_curl" => "Segment_Consumer_ForkCurl", "lib_curl" => "Segment_Consumer_LibCurl");
        # Use our socket consumer by default
        $consumer_type = isset($options["consumer"]) ? $options["consumer"] : "lib_curl";
        $Consumer = $consumers[$consumer_type];
        $this->consumer = new $Consumer($secret, $options);
    }