webmid/laravel-ads-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webmid/laravel-ads-sdk

Composer 安装命令:

composer require webmid/laravel-ads-sdk

包简介

A Laravel Ads SDK for Google Ads, Bing Ads and Facebook Ads API

README 文档

README

Join the Discord – For support, updates and collaboration.

For Google Ads, Bing Ads and Facebook Ads API.

This is a wrapper for connecting each ad source into your Laravel application. This SDK provides a cleaner and a more consistent integration across many ad platforms than the official SDKs, and ultimately making it a lot easier to implement in your projects. You shouldn't have to learn how to communicate and understand the responses to every API.

Installation

Use Composer to install package.

Run composer require webmid/laravel-ads-sdk

Config

  1. Run php artisan vendor:publish --tag=laravel-ads-sdk

  2. Copy this to your .env and update with your credentials (if you dont have credentials, continue to the next step).

ADWORDS_DEVELOPER_TOKEN=""
ADWORDS_OAUTH2_CLIENT_ID=""
ADWORDS_OAUTH2_CLIENT_SECRET=""
ADWORDS_OAUTH2_REFRESH_TOKEN=""

BING_DEVELOPER_TOKEN=""
BING_CLIENT_ID=""
BING_CLIENT_SECRET=""
BING_REFRESH_TOKEN=""

FB_APP_ID=""
FB_APP_SECRET=""
FB_ACCESS_TOKEN=""
FB_REFRESH_TOKEN=""

Authentication

👉 For GoogleAds

You will need your developer token, client id and client secret to continue. Learn More

Follow the steps in the command line to generate a refresh token.

Run php artisan laravelads:token:generate --service=GoogleAds

Having Trouble? Learn More

👉 For BingAds

You will need your developer token, client id and client secret to continue. Learn More

Follow the steps in the command line to generate a refresh token.

Run php artisan laravelads:token:generate --service=BingAds

Having Trouble? Learn More

👉 For FacebookAds

You will need your app id, app secret and access token. Learn More

NOTE: It appears for facebook, you do not need to generate refresh token, once you have your access token, the api should connect as long as you've given yourself the correct access, permissions, scopes to marketing api and ads account.

🚀 Usage

Accessing GoogleAds, BingAds or FacebookAds use the following:

// The namespace to the Facade for laravel Ads SDK
use LaravelAds;

// calling Google Ads and including the Account ID
$googleAds = LaravelAds::googleAds()->with('ACCOUNT_ID');

// calling Bing Ads and including the Account ID
$bingAds = LaravelAds::bingAds()->with('ACCOUNT_ID');

// calling Facebook Ads and including the Account ID
$facebookAds = LaravelAds::facebookAds()->with('ACCOUNT_ID');

Google Ads

This uses the googleads-php-lib SDK for the Google Ads API

NOTICE – You will need to Request Google Ads API Access.

Need help with authentication?

Management

Reports

Bing Ads

This uses the BingAds-PHP-SDK for the Bing Ads API

NOTICE – You will need to Request Bing Ads API Access.

Need help with authentication or sandbox mode?

Management

Reports

Facebook Ads

This uses the facebook-php-business-sdk for Facebook Marketing API

Management

Reports

Customization

We realize that we can't add every endpoint so in order to help improve your developer experience, we have made the Service classes Macroable. Macros are a way to add a new custom method to the classes. This way you are able to utilize the existing auth and all of the other goodies that come with this package.

Typically, you should call this method from the boot method of one of your application's service providers, such as the App\Providers\AppServiceProvider service provider:

public function boot()
{
    LaravelAds\Services\BingAds\Service::macro('addUetTags', function($tags){
        $serviceCall = $this->call(ServiceClientType::CampaignManagementVersion13);

        try {
            $request = new AddUetTagsRequest();
            $request->UetTags = $tags;

            $serverResponse = $serviceCall->GetService()->AddUetTags($request);

            return $serverResponse;
        } catch (\Exception $e) {
            print $serviceCall->GetService()->__getLastRequest()."\n";
            print $serviceCall->GetService()->__getLastResponse()."\n";
        }
    });

    LaravelAds\Services\GoogleAds\Service::macro('dd', function(){
        dd($this);
    });
}

Then in your controller or job you would call:

$bingAds = LaravelAds::bingAds()->addUetTags([
    [
        'Name' => 'Extensible!',
        'Description' => 'No PR Needed!',
    ]
]);

$bingAds = LaravelAds::googleAds()->dd();

Contributions

We are actively looking for new contributors.

If you want to contribute, Join the Discord channel and/or submit pull requests.

License

Laravel Ads SDK (This Package) is open-sourced software licensed under the MIT license. USE AT YOUR OWN RISK. Laravel Ads SDK is a tool to help you manage your accounts, it does not guarantee features listed here will work as described. If you do find a bug, please feel free to submit an issue. This package is not affiliated with Laravel LLC or the Laravel Framework team.

webmid/laravel-ads-sdk 适用场景与选型建议

webmid/laravel-ads-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 09 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「ads」 「bing-ads」 「google-ads」 「facebook-ads」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 webmid/laravel-ads-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webmid/laravel-ads-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 webmid/laravel-ads-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 15
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 46
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-09-22