plainrouter/sdk to call the Plainrouter Conversion API from PHP. Published version 0.1.0 targets signed API contract 0.5.0; it provides event, operations and sandbox groups. The generated client does not call Meta’s Graph API directly.
Requirements and installation
You need PHP 8.2 or newer with cURL, JSON and mbstring, plus Composer. For production, store a workspace Server secret in your server’s secret manager, connect the intended Meta dataset, and record the actual advertising consent. Install the released package:Try the sandbox first
Configure production access
https://plainrouter.com/api/v1. Keep the secret out of source control, browser code and logs. A successful empty list is valid; it does not prove browser installation or Meta delivery. verifySignalIngestion() is a separate identity-free diagnostic write and does not replace a browser arrival.
Send a Meta conversion
Choose your backend as the purchase owner and confirm payment before sending. Persist the event body first. This example assumes$order and $consent come from your own recorded order and consent data; it can create a real conversion.
consent.captured_at locally when visitor identity is present; this does not obtain consent or replace server validation.
New ingestion returns HTTP 202; an identical event-ID retry can return 200 with duplicate: true. Reuse the persisted body after an uncertain timeout, checking that advertising use remains permitted. A duplicate does not update the original event or replay a failed delivery.
Inspect the event’s deliveries separately. accepted confirms destination acceptance; queued or retrying work remains pending. Acceptance does not prove attribution or better ad performance. See delivery statuses.
Troubleshooting
API failures use
Plainrouter\OpenAPI\ApiException; inspect the HTTP code without logging its credential-bearing request or customer payload. Generated models and lower-level APIs live under Plainrouter\OpenAPI.
Continue with Conversion API handling and deduplication.