This library works with a vanilla PHP version 5.2+ environment. Do note that this class library is blocking, as PHP has no good platform-independent way of setting up asynchronous processing queues.

  1. Download the latest version of the Katana PHP library from:
  2. Include the PHP library in your source: require_once('KApi.php');
  3. Initialize a fresh tracking object in your source: $aKApi = new KApi($clientId, $appId, $appPassword);
  4. Register an Account Id for later use:
$aKApi->loadAccountCreate(KApi::getISO8601UTCString(), "", "Free", "en-US", "US", "F", KApi::getISO8601UTCString(), 0.00, "Desktop Web");
Load an Account Id that was created just now (the KApi::getISO8601UTCString() method invocation) for an American female using the “Desktop Web” platform.
  1. Register a Character Id (if your application uses the concept of characters):
$aKApi->loadCharacterCreate(KApi::getISO8601UTCString(), "master chiff", "", "warrior", "spartan", "M", "machine", "x 137", 0);
Load a Character Id of a male spartan created just now.
  1. Log a Login:
$aKApi->logLogin(KApi::getISO8601UTCString(), "", "master chiff", 0, "Desktop Web", 0);
The “” account just logged in with her “master chiff” character called “x 137” using the “Desktop Web” platform.
  1. Log a Logout
$aKApi->logLogout(KApi::getISO8601UTCString(), "", "master chiff", 0, "Desktop Web", 0));
The corresponding logout of the “master chiff” character.

How was that?

For more examples, be sure to take a look at the test cases in the aforementioned kapi-php-lib repository.

Note that any Account Id or Character Id you want to reference must first be initialized; the initialization only has to happen once over the lifetime of any Id. Please see the inline comment-help in the library’s source for accepted parameter values. The numeric values for $theClientId and $theAppId can be obtained from the account management panel, or ask your account manager for help.