Chapter 5.7 • Backend Runtimes
PHP, Laravel & WordPress / WooCommerce Integration
Inject localized discounts and auto-apply promo codes inside Laravel controllers, Symfony apps, or custom WordPress hooks.
Laravel Controller / Service Layer
Using Laravel's Http client facade:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class PricingController extends Controller
{
public function index(Request $request)
{
$response = Http::timeout(2)
->withHeaders([
'CF-Connecting-IP' => $request->ip(),
])
->get('https://parityedge-edge-api.g-saichakri.workers.dev/v1/resolve', [
'projectId' => config('services.parityedge.project_id'),
]);
$parity = $response->json();
return view('pricing', [
'basePrice' => 49.00,
'parity' => $parity,
]);
}
}WordPress & WooCommerce Hook
Add to your child theme's functions.php to automatically enqueue the 0-CLS banner script on product and checkout pages:
add_action('wp_enqueue_scripts', function() {
if (is_product() || is_cart() || is_checkout()) {
wp_enqueue_script(
'parityedge-runtime',
'https://parityedge-edge-api.g-saichakri.workers.dev/v1/parity.global.js',
array(),
null,
true
);
// Pass project ID as script attribute
add_filter('script_loader_tag', function($tag, $handle) {
if ($handle === 'parityedge-runtime') {
return str_replace(' src', ' data-project-id="prj_live_YOUR_KEY" async src', $tag);
}
return $tag;
}, 10, 2);
}
});Next: No-Code & E-Commerce Guide
Embed into Webflow, Framer, and Shopify in under 60 seconds.