setono / meta-conversions-api-php-sdk
PHP library with basic objects and more for working with Facebook/Metas Conversions API
Installs: 74 734
Dependents: 3
Suggesters: 0
Security: 0
Stars: 13
Watchers: 2
Forks: 3
Open Issues: 3
Requires
- php: >=7.4
- composer-runtime-api: ^2.0
- ext-json: *
- facebook/php-business-sdk: ^14.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0 || ^2.0
- psr/log: ^1.1 || ^2.0 || ^3.0
- webmozart/assert: ^1.11
Requires (Dev)
- infection/infection: ^0.26
- kriswallsmith/buzz: ^1.2
- nyholm/psr7: ^1.5
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.17
- setono/code-quality-pack: ^2.2
This package is auto-updated.
Last update: 2024-12-20 14:58:31 UTC
README
Installation
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
Usage
use Setono\MetaConversionsApi\Event\Event; use Setono\MetaConversionsApi\Pixel\Pixel; $event = new Event(Event::EVENT_VIEW_CONTENT); $event->eventSourceUrl = 'https://example.com/products/blue-jeans'; $event->userData->clientUserAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36'; $event->userData->email[] = 'johndoe@example.com'; $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(); $client->sendEvent($event);