cdnsteve/segment-php-sdk

Segment.com PHP SDK

Maintainers

Package info

github.com/cdnsteve/segment-php-sdk

pkg:composer/cdnsteve/segment-php-sdk

Statistics

Installs: 7 933

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2015-11-30 15:53 UTC

This package is not auto-updated.

Last update: 2026-03-05 01:02:45 UTC


README

PHP SDK for working with the Segment.com analytics API. Uses PHP namespaces, GuzzleHttp and Composer.

Build Status

Please note this is in heavy development and should not yet be used in production.

Installation:

composer require cdnsteve/segment-php-sdk

Examples:

<?php
require __DIR__ . '/vendor/autoload.php';

use CdnSteve\Segment\Segment;
use CdnSteve\Segment\Analytics;

Segment::config([
  'api_key' => 'YOUR_API_KEY',
  'timeout' => 2.0, // HTTP request in seconds.
  ]);

// Setup unique identity to track.
Analytics::identify([
  'userId'=> '5114'
]);

// Track it!
Analytics::track([
  'userId'=> '5114',
  'event' => 'Purchase item',
  'properties' => [
    'product' => 'Solution 10',
    'premium_frequency' => 'monthly',
    'insurance_coverage' => 250000,
    'premium' => 50.35,
  ]
]);

License:

MIT License