Documentation Index
Fetch the complete documentation index at: https://docs.topsort.com/llms.txt
Use this file to discover all available pages before exploring further.
Topsort.php is a PHP Software Development Kit for Topsort Promoted Listings API.
Installation
Install with Composer:
composer require topsort/sdk
Or add to your composer.json:
{
"require": {
"topsort/sdk": "3.0.0"
}
}
Running an Auction
<?php
use Topsort\SDK;
$topsort_client = new SDK("my_api_key");
$products = ["i8bfHPJaxcAb3", "gDG0HV97ed2s"];
$slots = 1;
$auction_result = $topsort_client->create_auction($slots, $products)->wait();
Reporting Click Events
<?php
use Topsort\SDK;
$topsort_client = new SDK('my_api_key');
$placement = [
"path" => "/categories/shoes",
];
$topsort_client->report_click([
"placement" => $placement,
"resolvedBidId" => "AKFU78",
]);
Reporting Impression Events
<?php
use Topsort\SDK;
$topsort_client = new SDK('my_api_key');
$impression = [
"placement" => [
"path" => "/categories/shoes",
],
"resolvedBidId" => "AKFU78",
];
$topsort_client->report_impression($impression);
Reporting Purchase Events
<?php
use Topsort\SDK;
$topsort_client = new SDK('my_api_key');
$items = [
[
"productId" => "gDG0HV97ed2s",
"quantity" => 2,
"unitPrice" => 10000,
]
];
$topsort_client->report_purchase([
"occurredAt" => new DateTime(),
"items" => $items,
]);
For full documentation, see the GitHub repository.