Download the PHP package aghfatehi/laravel-meta-conversions without Composer

On this page you can find all versions of the php package aghfatehi/laravel-meta-conversions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-meta-conversions

Total Downloads Latest Version PHP Version Tests


Laravel Meta Conversions — Meta Pixel & Facebook CAPI Package

The complete Meta Pixel & Facebook Conversions API solution for Laravel.

Laravel Meta Conversions is a complete Meta Pixel Laravel Package and Facebook Pixel Laravel Package that integrates Laravel Facebook Pixel browser tracking with Laravel Meta Conversions API (CAPI) server-side tracking. It delivers accurate Server Side Tracking Laravel for reliable Meta Conversion Tracking and Facebook Conversion Tracking across your entire ecommerce funnel.

Goal: High-precision Laravel Ecommerce Tracking with event deduplication via unified event_id across browser + server for maximum Meta Advanced Matching quality. Built for Laravel Marketing Analytics and data-driven ad optimization.


Features

General

Client-side (Laravel Meta Pixel)

Server-side (Laravel Meta Conversions API)

User Data & Meta Advanced Matching

Queue & Performance

Testing & Logging

Security & Error Handling


Installation

Step 1: Install the package

Laravel auto-discovers the Service Provider. If you disable auto-discovery, register manually:

Step 2: Publish config

Config file published to config/facebook-conversion-service.php.

Step 3: Publish views (optional)

Views published to resources/views/vendor/facebook-conversion/pixel.blade.php.


Setup

1. Get your Facebook Pixel ID

  1. Open Facebook Events Manager → Meta Events Manager
  2. Select an existing pixel or create a new one for Laravel Meta Pixel
  3. Copy the Pixel ID from the top
  4. Set in your .env:

2. Get your CAPI Access Token

  1. In Meta Events ManagerSettings
  2. Scroll to Conversion API
  3. Click Generate Access Token
  4. Copy the token (starts with EAA...)
  5. Set in your .env:

Tokens may expire. Regenerate periodically. Enable domain verification in Business Manager.

3. Configure additional variables


Usage

Add Pixel to your layout

Insert this in your <head> tag:

Or using @include:

The pixel automatically fires fbq('track', 'PageView') on every page load.

Real-world Examples from an Ecommerce Store

View Content (Product Page)

Use in HomeController@product when a visitor views a product page:

Add to Cart

Use in CartController@addToCart after adding a product:

Add to Wishlist

Use in WishlistController@store:

Purchase (most important event)

Use in OrderController@store after order creation:

Complete Event List


Event Builder (Fluent API)

For full control over your Laravel CAPI event payload:

Or build the event object and send it later:


Event Deduplication — Core of Meta Conversion Tracking

Meta requires a unified event_id sent from both Laravel Facebook Pixel (browser) and Laravel CAPI (server) to identify duplicate events. This is the foundation of accurate Facebook Conversion Tracking.

How it works

The package generates a UUID v4 automatically for every event. You can customize it:

To pass event_id from server to Pixel (e.g., from an API response):


User Data with Meta Advanced Matching

Automatic Data Collection — for Meta Advanced Matching

Whenever you fire an event, the package automatically collects user data to enhance Meta Events Manager with Meta Advanced Matching:

SHA-256 Hashing per Meta Requirements

All data is hashed with SHA-256 as required by Meta Conversion Tracking:

Hashing Reference

Field Original Hashed
em [email protected] SHA-256(lowercase(trim(email)))
ph +966 55 123 4567 SHA-256(strip non-numeric)
fn Ahmed SHA-256(lowercase(trim))
ln Ghfatehi SHA-256(lowercase(trim))
ct Riyadh SHA-256(lowercase(trim))
st Riyadh Province SHA-256(lowercase(trim))
zp 12345 SHA-256(lowercase(trim))
country SA SHA-256(lowercase(trim))
external_id user_123 SHA-256

Queue Support

In production, enable the queue to avoid blocking HTTP requests when using Laravel CAPI:

Make sure a queue worker is running:

How it works with FACEBOOK_QUEUE=true:

The controller returns immediately. The event is processed in the background.


Middleware

TrackFacebookPageView

Automatically sends PageView via Server Side Tracking Laravel on every GET request:

Or on specific routes:

The middleware sends the PageView after the response is sent (terminate method) to avoid slowing down the page.


Testing Events via Meta Events Manager

1. Using Test Event Code

In development, use Meta's test code to validate your Laravel CAPI integration:

Open Meta Events ManagerTest Events and watch your Laravel Meta Conversions API events arrive in real time.

2. Using Artisan Command

3. Verify in Meta Events Manager

After sending events:

  1. Open Meta Events Manager → Meta Events Manager
  2. Go to Test Events tab (if using Test Event Code)
  3. Or go to Diagnostics to see real events
  4. Check Event Match Quality for each event

Logging

Logs are written to storage/logs/facebook-conversion.log with daily rotation (30 days).

Access token is masked: EAAJjm****


Production Checklist


Troubleshooting

Problem Solution
Events not appearing Check FACEBOOK_ENABLED=true and valid Pixel ID
401 Unauthorized Regenerate Access Token in Meta Events Manager
Low match quality Send more user data (email, phone, fbp, fbc) for Meta Advanced Matching
Duplicate events Ensure event_id is unique per event (package generates UUID automatically)
Queue not working Check php artisan queue:work and queue connection
Config error Check storage/logs/facebook-conversion.log
Token expired Regenerate in Meta Events Manager → Settings → Conversion API

Testing


Architecture

Data flow:


License

MIT License. See LICENSE for details.


Built by Ahmed Ghfatehi · fsoftdev.com


All versions of laravel-meta-conversions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0 || ^11.0 || ^12.0
illuminate/http Version ^10.0 || ^11.0 || ^12.0
illuminate/bus Version ^10.0 || ^11.0 || ^12.0
illuminate/view Version ^10.0 || ^11.0 || ^12.0
ramsey/uuid Version ^4.0
guzzlehttp/guzzle Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package aghfatehi/laravel-meta-conversions contains the following files

Loading the files please wait ...