Setup and operations
Connecting a PHP Edge Adapter to Traffic Routing
The PHP layer should collect only required context, request a decision securely, and handle unavailable dependencies predictably.
Keep the adapter thin
Limit the PHP entry point to normalizing allowed request context, calling the decision service, validating the response, and applying a documented action. Keep campaign policy in the routing control plane so deployments do not diverge.
Protect credentials and inputs
Store keys in server configuration, never emit them into HTML or client scripts, and send requests over authenticated transport. Validate forwarded host, path, and parameter values before using them in redirects or upstream requests.
Choose a bounded failure policy
Set connection and response timeouts, reject malformed decisions, and define a safe default page. Avoid infinite retries inside the visitor request because they amplify an outage and leave the browser waiting.
Deploy without exposing internals
Verify PHP runtime extensions, environment variables, file permissions, logs, and web-server routing on a staging hostname. Error pages should help operators while withholding secrets and private service addresses from visitors.
Test decisions and dependency loss
Send fixtures for each expected routing outcome, an invalid signature or credential, a timeout, and a malformed response. Confirm destination, HTTP behavior, server log correlation, and the event recorded by DuckRoute.