Search by

omnipulse / google-reviews

GlitchArt

Omnipulse's Google reviews: an establishment's Google rating and reviews through the Places API (New) - up to five, with their authors' attribution - and, for its owner, every review and replying through the Business Profile API; the link to leave a review; Google's display and caching rules declare

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

This package is auto-updated.

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


README

Formerly omnireview/google (moved on 2026-11-10, when omnireview and omnifund merged into omnipulse: Omnireview\Google\ is now Omnipulse\GoogleReviews\, GoogleGateway is GoogleReviewsProvider, GoogleGatewayFactory is GoogleReviewsFactory; the factory is google-reviews (was google); this package replaces the former name).

Google reviews for omnisense/omnipulse: any place's rating, number of ratings and up to five reviews through the Places API (New); for the place's owner, every review and replying through the Business Profile API.

Install and a first call

composer require omnipulse/google-reviews

No account for this first call: the Places API's answer is recorded (Omnipulse\Testing\RecordedHttpClient answers in place of the API), so nothing leaves the process. A real call needs a Google Cloud project with the Places API (New) enabled and its API key; replying to reviews needs the Business Profile API besides.

<?php

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

use Omnipulse\GoogleReviews\GoogleReviewsFactory;
use Omnipulse\Model\Place;
use Omnipulse\Testing\RecordedHttpClient;

// the Places API's answer, recorded: nothing sent. HttpClient::create() (symfony/http-client) for a real call.
$http = RecordedHttpClient::routes([
    'GET /places/ChIJLU7jZClu5kcR4PcOOO6p3I0' => '{"id": "ChIJLU7jZClu5kcR4PcOOO6p3I0", "displayName": {"text": "Maison Érable"}, "rating": 4.6, "userRatingCount": 128, "googleMapsUri": "https://maps.google.com/?cid=10223305813012340704", "reviews": []}',
]);
$google = (new GoogleReviewsFactory($http))->create(['api_key' => 'recorded', 'language' => 'fr']);

$rating = $google->rating(new Place('ChIJLU7jZClu5kcR4PcOOO6p3I0'));
echo $rating->value, ' from ', $rating->count, ' reviews, ', $rating->url, "\n";   // 4.6 from 128 reviews, https://maps.google.com/?cid=...

With your credentials, through the family's registry:

use Omnipulse\GoogleReviews\GoogleReviewsFactory;
use Omnipulse\Model\Place;

$provider = (new GoogleReviewsFactory($httpClient))->create(['api_key' => getenv('GOOGLE_PLACES_KEY'), 'language' => 'fr']);

$place = new Place('ChIJLU7jZClu5kcR4PcOOO6p3I0');     // the place ID: the one thing Google lets you keep
$provider->rating($place);                              // 4.6 from 128, with its Google Maps link
$provider->reviews($place);                             // up to five, with their authors
$provider->writeUrl($place);                            // search.google.com/local/writereview?placeid=...

Written from Google's documentation of the Places API (New) and the Business Profile API, read on 2026-10-08. Not verified in real: no key - but for the link to write a review, which answered.

Documentation: the options, the calls, Google's terms, what was verified.

Usage policy

Google reviews'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://developers.google.com/maps/documentation/places/web-service/policies): 300 calls a minute (the Business Profile APIs' figure, written over Places', whose per-method quota Google does not publish), 10 replies a minute per profile; caching, storage and redistribution forbidden (the place ID alone kept); "Google Maps" credited on display, each review with its author. 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).

Responsibility

This package is an independent, unofficial client: it is not affiliated with, endorsed by or sponsored by Google LLC. It reaches their services on behalf of whoever runs it, and it does not redistribute their data beyond the short excerpts recorded as test fixtures. Its MIT licence covers this package's code only and grants no right to the service or to its data.

Whoever installs and runs this package is responsible for complying with Google's terms (Google Maps Platform Terms of Service, Business Profile APIs terms), for obtaining whatever they require (an account, a key, a licence or subscription, an attribution or a citation, a rate limit to respect), and for any use made of what it returns. The authors publish it free of charge, make no commercial use of it, and accept no liability for how it is used (see LICENSE).

License: MIT since 2026-10-09; earlier versions remain published under LGPL-3.0-or-later.