Read from the package's own PHP files at the commit 25b5548dd42f: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.
GoogleTokenclassA bearer token for a Google API: the one given, or one obtained for a service account - a JWT signed with its private key (RS256) exchanged at its token_uri (the OAuth 2.0 JWT bearer grant, RFC 7523) - and kept until a minute before it expires.
4 methods
SearchConsoleFactoryclassGoogle Search Console, from its options:
5 options · 1 method · 1 constant
SearchConsoleProviderclassThe Search Console API (https://developers.google.com/webmaster-tools): POST sites/{site}/searchAnalytics/query - dimensions, "equals" filters, pages of rows (startRow, rowLimit up to 25,000) - with a bearer token.
5 methods
Omnireach\SearchConsole
GoogleToken class
final class GoogleToken GoogleToken.php:18
A bearer token for a Google API: the one given, or one obtained for a service account - a JWT signed with its private key (RS256) exchanged at its token_uri (the OAuth 2.0 JWT bearer grant, RFC 7523) - and kept until a minute before it expires.
The same class lives in omnireach/search-console and omnireach/ga4: two providers, one grant, no shared package for forty lines.
GoogleToken::__construct()
public function __construct(readonly JsonApi $api, readonly string $scope, readonly ?array $serviceAccount = null, ?string $token = null, readonly ?\Closure $clock = null)$serviceAccountthe service account's JSON key, decoded (client_email, private_key, token_uri)
$clockthe present as a UNIX time (a test's); time() when null
GoogleToken::credentials()
public static function credentials(string $jsonOrPath): arrayA service account's key: its JSON, or the path of its file.
GoogleToken::get()
public function get(): stringGoogleToken::assertion()
public function assertion(int $now): stringThe signed JWT the token is asked with.
SearchConsoleFactory class
final class SearchConsoleFactory extends ProviderFactory SearchConsoleFactory.php:22
Google Search Console, from its options:
site the property: "sc-domain:example.org" (a domain property) or "https://example.org/" credentials a service account's JSON key, or the path of its file - the account added as a user of the property (Search Console, Settings, Users and permissions); or: access_token a token with the webmasters.readonly scope, obtained elsewhere data_state "final" (the default: complete days only) or "all" (the last days, provisional) url https://searchconsole.googleapis.com/webmasters/v3
Options
| Option | Default | |
|---|---|---|
credentials | '' | |
access_token | '' | |
data_state | 'final' | |
url | 'https://searchconsole.googleapis.com/webmasters/v3' | |
site | required |
const SCOPE = 'https://www.googleapis.com/auth/webmasters.readonly'
SearchConsoleFactory::__construct()
public function __construct(readonly ?HttpClientInterface $http = null)SearchConsoleProvider class
final class SearchConsoleProvider implements SearchPerformanceInterface SearchConsoleProvider.php:19
The Search Console API (https://developers.google.com/webmaster-tools): POST sites/{site}/searchAnalytics/query - dimensions, "equals" filters, pages of rows (startRow, rowLimit up to 25,000) - with a bearer token.
SearchConsoleProvider::__construct()
public function __construct(readonly JsonApi $api, readonly GoogleToken $token, readonly string $site, readonly string $dataState = 'final', readonly string $url = 'https://searchconsole.googleapis.com/webmasters/v3')SearchConsoleProvider::getName()
public function getName(): stringSearchConsoleProvider::getTitle()
public function getTitle(): stringSearchConsoleProvider::capabilities()
public function capabilities(): CapabilitiesSearchConsoleProvider::searchPerformance()
public function searchPerformance(ReachQuery $query): Report