PHP code example of cossou / trak-io-api-client

1. Go to this page and download the library: Download cossou/trak-io-api-client 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/ */

    

cossou / trak-io-api-client example snippets




use Cossou\Trakio;

$trakio = Trakio::init('YOUR-API-TOKEN');

// or
// $trakio = Trakio::init('YOUR-API-TOKEN', array('distinct_id' => 123));

try {
    $response = $trakio->identify(array('distinct_id' => 123, 'properties' => array('name' => 'Hélder Duarte')));
    var_dump($response);
} catch(Exception $e) {
    echo $e->getMessage();
}


'providers' => array(
    ...
    'Cossou\TrakioServiceProvider',
)

'aliases' => array(
	...
   	'Trakio'		  => 'Cossou\Facades\Trakio',


Route::get('/', function()
{
	$trak = new Trakio;

	try {
		$response = $trak::identify(array('distinct_id' => 123, 'properties' => array('name' => 'Hélder Duarte')));
		dd($response);
	} catch(Exception $e) {
		dd($e->getMessage());
	}	
}