Search by

omnipulse / bing-webmaster

GlitchArt

Omnipulse's Bing Webmaster Tools, under any PHP host: a site's search queries and pages in Bing with their clicks, impressions, CTR and average position, week by week or over a period, through the Bing Webmaster API (JSON, API key).

v1.0.0 2026-11-13 10:32 UTC

This package is auto-updated.

Last update: 2026-11-13 13:46:53 UTC


README

Formerly omnireach/bing-webmaster (renamed on 2026-11-10 with its family: Omnireach\ is now Omnipulse\; this package replaces the former name).

omnisense/omnipulse's Bing Webmaster Tools, under any PHP host: a site's search queries and pages in Bing with their clicks, impressions, CTR and average position, period by period or summed over the query's days.

Install and a first call

composer require omnipulse/bing-webmaster

No account for this first call: Bing Webmaster's answer is recorded (Omnipulse\Testing\RecordedHttpClient answers in place of the API), so nothing leaves the process. A real call needs a Bing Webmaster Tools account where the site is verified, and its API key.

<?php

require __DIR__.'/vendor/autoload.php';

use Omnipulse\BingWebmaster\BingWebmasterFactory;
use Omnipulse\Model\{Dimension, ReachQuery};
use Omnipulse\Testing\RecordedHttpClient;

// Bing Webmaster's answer, recorded: nothing sent. HttpClient::create() (symfony/http-client) for a real call.
$http = RecordedHttpClient::routes([
    'GET /GetQueryStats' => '{"d": [{"Query": "atelier poterie strasbourg", "Date": "/Date(1790578800000-0700)/", "Clicks": 10, "Impressions": 200, "AvgClickPosition": 4, "AvgImpressionPosition": 5}]}',
]);
$bing = (new BingWebmasterFactory($http))->create(['api_key' => 'recorded', 'site' => 'https://atelier.example.org/']);

$report = $bing->searchPerformance(new ReachQuery(new DateTimeImmutable('2026-09-01'), new DateTimeImmutable('2026-10-31'), [Dimension::Query]));
foreach ($report->rows as $row) {
    echo json_encode($row->dimensions + $row->metrics, JSON_UNESCAPED_SLASHES), "\n";   // {"query":"atelier poterie strasbourg","clicks":10,"impressions":200,...}
}

With your credentials, through the family's registry:

use Omnipulse\BingWebmaster\BingWebmasterFactory;
use Omnipulse\Registry;
use Symfony\Component\HttpClient\HttpClient;

$registry = new Registry([new BingWebmasterFactory(HttpClient::create())], [
    'bing' => ['factory' => 'bing-webmaster', 'options' => ['api_key' => '...', 'site' => 'https://example.org/']],
]);

Options: api_key (Bing Webmaster Tools, Settings, API access), site (as verified there), url.

The API, as read on 2026-10-24

The Bing Webmaster API's JSON endpoint (https://ssl.bing.com/webmaster/api.svc/json/, its reference at https://learn.microsoft.com/en-us/dotnet/api/microsoft.bing.webmaster.api.interfaces.iwebmasterapi): GetQueryStats (queries), GetPageStats (pages; the page is in the Query field), GetRankAndTrafficStats (the whole site), with siteUrl and apikey. Bing chooses the periods: one row per week ("the data will be updated every week"), about six months back, dates as /Date(ms-0700)/. This package keeps the rows inside the query's days, one per period when the date is asked for, summed otherwise (the position weighted by impressions, from AvgImpressionPosition); filters work on the dimension reported; the whole site has no position. Positions are passed as Bing gives them (not verified against a live account).

Terms: Bing Webmaster Tools' terms; no quota figure in what was read - keep calls few and cache the answers. Reuse: no maintained PHP client was found.

Usage policy

Bing Webmaster Tools's usage policy is declared as data in policy.json (omnisense/contracts' schema, named in composer.json's extra.omnisense.policy), its terms read on 2026-11-10 (https://learn.microsoft.com/en-us/dotnet/api/microsoft.bing.webmaster.api.interfaces.iwebmasterapi): no rate limit declared: Microsoft publishes no quota for the statistics calls (rateLimits: null, unknown); rights unknown; an API key. omnipulse's registry enforces it - a call over a limit is never made, a 429 and its Retry-After hold every next call (UsageLimitReachedException) - and a site may tighten it, never loosen it (omnisense/omnipulse's docs/policies.md).

Verified, and not

  • Verified (the core's harness, PHP 8.4): queries summed over a period, week by week, the whole site, a filter, what Bing cannot answer, an error message - against the JSON sample of GetQueryStats in Bing's reference and rows composed in its shape; every class loading with the package's requirements alone (BareTest).
  • Not verified live: no Bing Webmaster key was used.

Licence

MIT. An unofficial client, affiliated with Microsoft in no way.