ReactifySDK · PHP
Print the bootstrap globals and reactify.js from PHP, then echo reactify-thread. Prefer the WordPress plugin when you are on WP—it injects apiKey for you.
1. Helper
reactify_sdk_embed.php
<?php
/** reactify_sdk_embed.php */
function reactify_sdk_script_url(): string {
return 'https://reactify-cdn.s3.us-east-2.amazonaws.com/reactify.js?v=1.1.34';
}
function reactify_sdk_print_boot(string $apiKey, string $base = 'https://api.reactionsaas.com'): void {
$base = rtrim($base, '/');
$apiKey = trim($apiKey);
$cfg = json_encode(
['base' => $base, 'apiKey' => $apiKey],
JSON_UNESCAPED_SLASHES
);
// Same globals WordPress/Shopify set — required for in-page recorder popup
echo '<script>window.reactifyWprtEmbed=' . $cfg . ';'
. 'window.reactifyShopifyEmbed=window.reactifyWprtEmbed;'
. 'window.REACTIFY_EMBED_BASE=' . json_encode($base, JSON_UNESCAPED_SLASHES) . ';</script>' . "\n";
$src = htmlspecialchars(reactify_sdk_script_url(), ENT_QUOTES, 'UTF-8');
echo '<script src="' . $src . '" defer></script>' . "\n";
}
function reactify_sdk_thread(string $threadId, string $base = 'https://api.reactionsaas.com'): string {
$threadId = htmlspecialchars($threadId, ENT_QUOTES, 'UTF-8');
$base = htmlspecialchars(rtrim($base, '/'), ENT_QUOTES, 'UTF-8');
return '<reactify-thread thread="' . $threadId . '" data-base="' . $base . '"></reactify-thread>';
}2. Page
thread.php
<?php
require_once __DIR__ . '/reactify_sdk_embed.php';
$apiKey = getenv('REACTIFY_API_KEY') ?: '';
$threadId = 'YOUR_THREAD_ID';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Thread</title>
</head>
<body>
<?php
if ($apiKey !== '') {
reactify_sdk_print_boot($apiKey);
} else {
// Without apiKey, React To This opens https://api.reactionsaas.com/reactify/record
$src = htmlspecialchars(reactify_sdk_script_url(), ENT_QUOTES, 'UTF-8');
echo '<script src="' . $src . '" defer></script>';
}
echo reactify_sdk_thread($threadId);
?>
</body>
</html>ReactionSDK overlays in PHP
For on-video overlays (sdk.js + reaction-video), see ReactionSDK PHP.