Search by

sero / appkit

brainvine

Sero CDP AppKit — server-side personalization client (visitor context, personalized product sets, recommendations, decisions) for PHP: Magento 2, WooCommerce, Laravel.

v0.1.0 2026-09-21 16:59 UTC

This package is auto-updated.

Last update: 2026-09-21 17:13:13 UTC


README

Server-side personalization client for Sero CDP — Magento 2, WooCommerce, Laravel or plain PHP 8.1+. No dependencies beyond curl and json.

composer require sero/appkit
use Sero\AppKit\SeroAppKit;

$sero = new SeroAppKit(getenv('SERO_CDP_API_KEY'), 'https://cdp.sero.tech');
$visitor = SeroAppKit::visitorFromCookie($_COOKIE);          // ['anonymous_id' => …] from the pixel cookie, or []

$recs = $sero->recommendations($visitor, ['type' => 'similar', 'product_id' => $sku, 'limit' => 6]);
foreach ($recs['products'] as $p) {
    // $p['name'], $p['price_cents'], $p['url'], $p['image_url'], $p['reason']
}

$set = $sero->productSet($setId, $visitor, ['limit' => 8, 'exclude_purchased' => true]);
$ctx = $sero->context($visitor);                              // $ctx['first_name'], $ctx['budget_band'], …
$decision = $sero->decide($visitor, ['page_url' => $url, 'page_type' => 'product', 'product_id' => $sku]);
$sero->trackExposures($visitor, $decision);                   // report the assigned arms (control included)

// never let a hiccup block the page
$products = $sero->safe(fn () => $sero->recommendations($visitor, ['type' => 'popular']))['products'] ?? [];

Known customer (account page, e-mail, POS): SeroAppKit::visitorFromEmail($email) — the address is hashed before it leaves your server.

The key needs the personalization_read scope (plus events_write for track*). Full guide: https://cdp.sero.tech/api/v1/appkit.md.