PHP code example of uecode / segment-io-php

1. Go to this page and download the library: Download uecode/segment-io-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uecode / segment-io-php example snippets


use SegmentIO\Client;

$client = new Client(['write_key' => $writeKey]);

// Identify the user - assuming, below, that you
// have a $user object from your database
$client->identify([
    'userId' => $user->getId(),
    'traits' => [
        'name' => $user->getName(),
        'email' => $user->getEmail()
    ]
]);

// Track an event (userId or anonymousId is