Skip to content

ONE400/traklight-php-api-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Traklight PHP API Wrapper

This is a simple PHP wrapper for the Traklight API. This wrapper supports creating users and auto-logging users into their Traklight dashboard.

Usage

Initialize Wrapper

$tk = new TraklightApiWrapper('your_subdomain','your_auth_key');
$tk->useStaging = true;  # Optionally use Traklight test server

Retrieve all users from your sub-domain

$users = $tk->getUsers();
var_dump($users);

Retrieve a specific user from your sub-domain

$user = $tk->getUser('user_id');
var_dump($user);

Create a user on your sub-domain

$user = $tk->createUser(Array(
  'email'        => '[email protected]',   # required
  'firstName'    => 'Joe',               # required
  'lastName'     => 'Example',           # required
  'timeZone'     => 'America/Phoenix',   # optional  default "UTC"
  'password'     => 'foobarFB1',         # required
  'phoneNumber'  => '555-555-555',       # optional  default "555-555-5555"
  'postalCode'   => '85003',             # optional  default "00000"
  'countryCode'  => 'US',                # required
));
var_dump($user);
  • timeZone - must be a value from the tz database
  • password - minLength=8, minNumLower=1, minNumUpper=1, minNumDigit=1
  • countryCode - must be 2 character ISO code

Automatically log a user into their Traklight Dashboard

<?php $url = $tk->getSessionUrl('[email protected]'); ?>
<iframe
id="traklight_iframe"
style="height: 100%; width: 100%"
src="<?= $url ?>"
name="traklight_app"
sandbox="allow-same-origin allow-forms allow-scripts allow-popups allow-top-navigation"
seamless>
</iframe>

About

A simple PHP wrapper for the Traklight.com API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages