PHP library with basic objects and more for working with Facebook/Metas Conversions API

v0.2.4 2023-11-20 12:21 UTC


Latest Version Software License Build Status Code Coverage Mutation testing


The easiest way to install this library is by installing the library along with its HTTP client dependencies:

composer require setono/meta-conversions-api-php-sdk kriswallsmith/buzz nyholm/psr7

If you want to use your own HTTP client, just do composer require setono/meta-conversions-api-php-sdk and then remember to set the HTTP client and factories when instantiating the Setono\MetaConversionsApi\Client\Client


use Setono\MetaConversionsApi\Event\Event;
use Setono\MetaConversionsApi\Pixel\Pixel;

$event = new Event(Event::EVENT_VIEW_CONTENT);
$event->eventSourceUrl = '';
$event->userData->clientUserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36';
$event->userData->email[] = '';
$event->pixels[] = new Pixel('INSERT YOUR PIXEL ID', 'INSERT YOUR ACCESS TOKEN');
// $event->testEventCode = 'test event code'; // uncomment this if you want to send a test event

$client = new Client();