Segment::init PHP Méthode

init() public static méthode

Initializes the default client to use. Uses the socket consumer by default.
public static init ( string $secret, array $options = [] )
$secret string your project's secret key
$options array passed straight to the client
    public static function init($secret, $options = array())
    {
        self::assert($secret, "Segment::init() requires secret");
        self::$client = new Segment_Client($secret, $options);
    }

Usage Example

Exemple #1
0
 public function __construct($cfg, $webhost)
 {
     $this->cfg = $cfg;
     $weburl = parse_url($webhost);
     $this->spaceHost = preg_replace('/\\.$/', '', $weburl['host']);
     // init Analytics lib
     \Segment::init($this->cfg['api_secret'], $this->cfg['api_options']);
 }
All Usage Examples Of Segment::init