Download und Konfiguration
Das PHP SDK unterstützt PHP 7.0 und höher. Konfigurieren Sie Ihren aktuellen Projektschlüssel, Umgebung, Endpunkt, stabile Besucher-ID, aktuelle URL, Server-Anmeldeinformationen und Analytics-Zustimmung.
Kundenstruktur
php
<?php
require_once __DIR__ . '/varypilot.php';
$ab = new ABPlatform\Client(array(
'projectKey' => $publicProjectKey,
'environment' => $environmentName,
'endpoint' => 'https://varypilot-edge-api.silva-pires-ricardo86.workers.dev',
'serverKey' => getenv('VARYPILOT_SERVER_KEY'),
'visitorId' => $stableVisitorId,
'url' => $currentUrl,
'cacheDir' => $privateWritableCacheDirectory,
'consent' => $analyticsConsentGranted
));
$ab->init();
$variant = $ab->getVariant($experimentKey, $controlVariantKey);
// Render first, then record exposure.
$ab->trackExposure($experimentKey, $variant);
$ab->flush();Cache und Lieferung
Verwenden Sie ein beschreibbares, privates Cache-Verzeichnis. Halten Sie die Server-Anmeldeinformationen außerhalb der öffentlichen Dateien und der Quellsteuerung. Überprüfen Sie das Verhalten auf Netzwerkfehler und nicht verfügbare Konfiguration, bevor Sie es in die Produktion einfügen.