PHPackages                             mtechraw/social-capi - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. mtechraw/social-capi

ActiveLibrary[API Development](/categories/api)

mtechraw/social-capi
====================

Laravel package to send CAPI events

v2.8(11mo ago)9251MITPHP

Since Jul 1Pushed 11mo agoCompare

[ Source](https://github.com/mtechraw/social-capi)[ Packagist](https://packagist.org/packages/mtechraw/social-capi)[ RSS](/packages/mtechraw-social-capi/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (2)Versions (15)Used By (0)

SocialCAPI – Laravel Social CAPI Integration
============================================

[](#socialcapi--laravel-social-capi-integration)

**SocialCAPI** is a Laravel 11+ compatible package that provides a wrapper for sending Facebook Conversions API (CAPI) events server-side using the official [`facebook/php-business-sdk`](https://github.com/facebook/facebook-php-business-sdk). It is ideal for tracking conversions and interactions directly from your backend with support for `test_event_code`, dynamic data, and Laravel configuration management.

---

🚀 Features
----------

[](#-features)

- Laravel 11 compatible
- Built on top of Facebook's official Business SDK
- Supports `test_event_code` for development and QA validation
- Fully dynamic input mapping for user data
- Easily configurable via Laravel config and `.env`
- Composer-installable, auto-discovered Laravel service provider

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require mtechraw/social-capi
```

---

🛠 Configuration
---------------

[](#-configuration)

### Step 1: Publish Configuration File

[](#step-1-publish-configuration-file)

```
php artisan vendor:publish --tag=config
```

This will publish `config/fb-capi.php`:

```
return [
    'pixel_id' => env('FB_PIXEL_ID'),
    'access_token' => env('FB_ACCESS_TOKEN'),
];
```

### Step 2: Set Environment Variables

[](#step-2-set-environment-variables)

Update your `.env` file:

```
FB_PIXEL_ID=your_facebook_pixel_id
FB_ACCESS_TOKEN=your_fb_access_token
```

---

✅ Usage Example
---------------

[](#-usage-example)

You can use the `FacebookChannel` class directly using Laravel's container:

```
use SocialCAPI\Facebook\FacebookChannel;

$data = [
    'email' => 'john@example.com',
    'ip' => '127.0.0.1',
    'city' => 'local',
    'state' => 'Texas',
    'country' => 'US',
    'event_name' => 'Purchase',
    'test_event_code' => 'TEST1234ABC', // Optional: for Facebook Events Manager test tab
];

app(FacebookChannel::class)->send($data);
```

---

⚙️ Advanced
-----------

[](#️-advanced)

### Supported Event Types

[](#supported-event-types)

You can send any standard Facebook CAPI event type including:

- `Purchase`
- `InitiateCheckout`
- `Lead`
- `AddToCart`
- etc.

You only need to specify the event name in the `event_name` key.

### Dynamic Data Input

[](#dynamic-data-input)

The input array can contain any of the following fields (optional, only what's provided will be sent):

- `email`
- `country`
- `city`
- `state`
- `ip`
- `event_name`
- `test_event_code`

---

🧪 Using test\_event\_code
-------------------------

[](#-using-test_event_code)

To send a test event (visible in Facebook Events Manager → Test Events):

1. Go to Events Manager → your Pixel → Test Events
2. Copy the test event code (e.g. `TEST1234ABC`)
3. Add it in the `$data` array like:

```
'test_event_code' => 'TEST1234ABC'
```

This event will appear in the Test Events tab for validation.

---

🧩 Folder Structure
------------------

[](#-folder-structure)

```
social-capi/
├── config/
│   └── fb-capi.php
└── src/
    └── Facebook/
        ├── FBServiceProvider.php
        ├── FacebookChannel.php
        └── FacebookMessage.php
```

📘 License
---------

[](#-license)

MIT License — see the [LICENSE](LICENSE) file for details.

---

🙋 Author
--------

[](#-author)

Developed with ❤️ by [Mukesh Rawat](https://github.com/mtechraw)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance50

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

13

Last Release

352d ago

Major Versions

v1.0.4 → v2.02025-07-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/edc7d91faa808ae2cad7d69b69855f0b064af18e9b23f55a23810c34d17f12dc?d=identicon)[mtechraw](/maintainers/mtechraw)

---

Top Contributors

[![mtechraw](https://avatars.githubusercontent.com/u/8155146?v=4)](https://github.com/mtechraw "mtechraw (16 commits)")[![lakshyagoyalpenitt](https://avatars.githubusercontent.com/u/161299358?v=4)](https://github.com/lakshyagoyalpenitt "lakshyagoyalpenitt (1 commits)")

### Embed Badge

![Health badge](/badges/mtechraw-social-capi/health.svg)

```
[![Health](https://phpackages.com/badges/mtechraw-social-capi/health.svg)](https://phpackages.com/packages/mtechraw-social-capi)
```

###  Alternatives

[defstudio/telegraph

A laravel facade to interact with Telegram Bots

816333.6k3](/packages/defstudio-telegraph)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

68171.6k](/packages/esign-laravel-conversions-api)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5021.9k](/packages/simplestats-io-laravel-client)[rapidez/core

Rapidez Core

1823.5k72](/packages/rapidez-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
