microsoft/bingads
Microsoft Bing Ads PHP SDK with PSR-4 autoloading and SOAP proxies for all Bing Ads API services. Simplifies OAuth authentication and integrates easily via Composer (microsoft/bingads) so you can build and manage advertising apps in PHP.
ext-soap. This reduces boilerplate for OAuth, authentication, and request/response handling.CampaignManagementService, ReportingService), mirroring Laravel’s modular service layer pattern. Ideal for encapsulating Bing Ads logic in dedicated repositories/services.Auth facade or custom guards for user-specific Bing Ads access (e.g., agency clients).ShouldQueue interfaces).bingads.campaign.created) for downstream processing (e.g., analytics, notifications).MaxCpc limits) can map to Laravel’s FormRequest validation.GetCampaignsByIds) may require chunking for large datasets. Laravel’s pagination or chunking helpers can mitigate this.BingAdsException) should translate SOAP errors to Laravel’s Problem or HttpException classes.msads.manage scope is now default; legacy scopes (e.g., msads.read) may fail. Test thoroughly post-migration.ext-soap Requirement: Must be enabled in php.ini. Use Laravel’s php artisan package:discover or a custom check in bootstrap/app.php to fail fast if missing..env for environment-specific configs (e.g., BINGADS_SANDBOX=true).php-soap-mock or custom MockHandler classes can help.HasApiTokens.)retry helper or custom middleware.)Log facade or Prometheus metrics.)CreateResponsiveAdRecommendation) be used? These may require additional validation or async processing.BingAdsService) with environment-specific configs (sandbox/production).
$this->app->singleton(BingAdsService::class, function ($app) {
return new BingAdsService(
config('bingads.client_id'),
config('bingads.client_secret'),
config('bingads.sandbox') ? 'login.windows-ppe.net' : 'login.microsoftonline.com'
);
});
config/bingads.php:
'scopes' => [
'production' => ['msads.manage'],
'sandbox' => ['msads.manage'],
],
BingAds facade for concise syntax (e.g., BingAds::campaign()->getByIds([123])).BingAdsAuthMiddleware to protect routes requiring Bing Ads access (e.g., /ads/campaigns).{campaign} → CampaignRepository).Cache::remember()).bingads_campaigns table to avoid repeated API calls.composer require microsoft/bingads).ext-soap and verify with php -m | grep soap.BingAdsService class to wrap SDK initialization and error handling.encrypter for sensitive data).BingAdsAuth service to handle token refreshes and scope validation.CampaignService, ReportingService).class CampaignService {
public function __construct(private BingAdsService $bingAds) {}
public function syncCampaigns(array $campaignIds): array {
return $this->bingAds->campaignManagement()
->GetCampaignsByIds(['CampaignIds' => $campaignIds]);
}
}
BingAdsJob.class GenerateReportJob implements ShouldQueue {
public function handle() {
$report = $this->bingAds->reporting()->GetReportDownloadUrl(...);
// Process download URL...
}
}
php artisan bingads:refresh-campaigns).class RefreshCampaignsCommand extends Command {
protected $signature = 'bingads:refresh-campaigns';
public function handle(BingAdsService $bingAds) {
$campaigns = $bingAds->campaignManagement()->GetCampaigns();
// Update local DB or cache...
}
}
soap, curl, openssl.redis (for token caching), queue (for async jobs)..env with Bing Ads credentials.BingAdsService and facade.AdService, ReportingService).campaign.updated).monolog).How can I help you explore Laravel packages today?