1. Go to this page and download the library: Download jobinja/threads-io-php-plug 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/ */
jobinja / threads-io-php-plug example snippets
use \Jobinja\ThreadsIo\ThreadsIoClient;
use \Jobinja\ThreadsIo\ThreadsIoService;
// The ThreadsIoClient class is the low level class used to make the API calls.
// It takes your eventKey in parameter, which is provided to you by Threads.io
$client = new ThreadsIoClient(YOUR_EVENT_KEY);
// The ThreadsIoService class is the high level class that you will use with the Entities to make your API Calls
// It takes your fresh new ThreadsIoClient object in argument to be instantiate
$service = new ThreadsIoService($client);
use \Jobinja\ThreadsIo\Entities\User;
use \Jobinja\ThreadsIo\Entities\Event;
use \Jobinja\ThreadsIo\Entities\Page;
// Whether you retrieve an object implementing the UserThreadableInterface from your DB...
$yourUser = $dao->getMemberById(2103);
// ...or that you create one using the provided entity class User...
$threadsIoUser = new User("ID254632", [
"name" => "Jesus Christ",
"company" => "Christian Church",
"date_of_birth" => "24/12/0001",
]);
...
// ... you'll be able to use them both with the ThreadsIoService
$service->identify($yourUser);
$service->identify($threadsIoUser);
use \Jobinja\ThreadsIo\Entities\User;
use \Jobinja\ThreadsIo\Entities\Event;
use \Jobinja\ThreadsIo\Entities\Page;
use \Jobinja\ThreadsIo\ThreadsIoClient;
use \Jobinja\ThreadsIo\ThreadsIoService;
// Instantiate an object that implements one of the Wabel\ThreadsIo\Interfaces
// (one of the provided classes in this case)
$user = new User("4815162342", [
"name" => "Hugo Reyes",
"status" => "Lost",
"other" => "Lottery winner"
]);
$event = new Event("New Lost Person Report", [
"plane" => "Oceanic 815",
"crash_location" => "Pacific Ocean"
]);
$page = new Page("New plane crash: Oceanic 815 on fire in the Pacific Ocean", [
"url" => "http://www.bignews.com/New-plane-crash-Oceanic-815-on-fire-in-the-Pacific-Ocean",
"referer" => "http://www.bignews.com",
"time_spent_on_page" => "18s"
]);
// Then grab or create a ThreadsIoService object
$client = new ThreadsIoClient($eventKey);
$service = new ThreadsIoService($client);
// Your now able to :
// Identify a user
$service->identify($user);
// Track an event
$service->track($user, $event);
// Track a page view
$service->page($user, $page);
// Remove a user
$service->remove($user);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.