ahmokhan1/meta-ads
Composer 安装命令:
composer require ahmokhan1/meta-ads
包简介
Meta Ads (CAPI + Insights) integration for Laravel CRM
README 文档
README
Laravel package for Meta Conversions API uploads and Marketing API insights sync.
Install
composer require ahmokhan1/meta-ads
Publish config and migrations:
php artisan vendor:publish --tag=meta-ads-config php artisan vendor:publish --tag=meta-ads-migrations php artisan migrate
Optional Lead model stub:
php artisan vendor:publish --tag=meta-ads-models
Requirements
- Laravel 10, 11, or 12
- PHP 8.1+ (Laravel 12 requires PHP 8.2+)
Environment
META_ADS_ACCESS_TOKEN= META_ADS_AD_ACCOUNT_ID= META_ADS_PIXEL_ID= META_ADS_API_VERSION=v21.0 META_ADS_CURRENCY_CODE=GBP META_ADS_EVENT_NAME=Purchase META_ADS_ACTION_SOURCE=website META_ADS_TEST_EVENT_CODE= META_ADS_CONVERSION_VALUE=0 META_ADS_ALLOW_LOCAL=false
Optional model/table overrides:
META_ADS_LEAD_MODEL=App\Models\Lead META_ADS_LEADS_TABLE=leads
Required Lead Columns
Leads table:
fbclid,fbc,fbpmeta_campaign_id,meta_ad_set_id,meta_ad_idmeta_conversion_sent_at,meta_conversion_error
These are created by the published migrations. If your project already has a leads table, the migration will add any missing Meta fields.
Conversions (CAPI)
Dispatch after a lead is enrolled/created:
use Ahmokhan1\MetaAds\Jobs\SendMetaAdsConversionJob; SendMetaAdsConversionJob::dispatch($lead->id)->delay(now()->addSeconds(5));
Behavior:
- Event id uses
lead-{id}. meta_conversion_sent_atis set only when Meta responds withevents_received >= 1.
Enable local testing with:
META_ADS_ALLOW_LOCAL=true META_ADS_TEST_EVENT_CODE=TEST123
Insights Sync
Sync daily campaign metrics:
php artisan meta-ads:sync --days=30
Use in scheduler:
$schedule->command('meta-ads:sync --days=30')->dailyAt('01:20');
Tables:
meta_ads_accountsmeta_ads_campaignsmeta_ads_metrics_daily
Notes
- This package expects standard Meta UTMs/click ids to be captured in your lead/order records.
- Update
config/meta_ads.phpif your model/table names differ.
License
MIT
ahmokhan1/meta-ads 适用场景与选型建议
ahmokhan1/meta-ads 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ahmokhan1/meta-ads 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ahmokhan1/meta-ads 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 38
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-18