NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages
Google Places for Laravel

Geolocation driver

The package registers a google_places driver on the geolocation-for-laravel manager. It forward-geocodes addresses and reverse-geocodes coordinates through Google Places, mapping the result onto geolocation’s own Location DTO. Google Places has no IP geolocation, so IP-only lookups fall through to the next provider.

It never aborts the pipeline

  • An unreachable Google — timeout, DNS failure, refused connection — is reported as geolocation’s ProviderUnavailableException, which the manager records on LocationResolutionFailed and skips.
  • Every other Places failure — no key configured, REQUEST_DENIED, OVER_QUERY_LIMIT, a client-side rate-limit fail-fast — is a miss (null), so the next provider answers. The PlacesRequestFailed event still fires for an API error.
  • The driver reads google-places’ own config (GOOGLE_PLACES_API_KEY, timeouts, rate limits). geolocation’s per-call overrides — withToken('google_places', …), withConfig(), withTimeout() — do not reach it.

Using the driver

Opt the driver into your geolocation pipeline:

// config/geolocation.php — consult google_places in your resolution order:
'pipeline' => ['maxmind_database', 'google_places', 'default'],

Or call it ad-hoc:

use RoundlyConsulting\Geolocation\DataTransferObjects\Coordinates;
use RoundlyConsulting\Geolocation\Facades\Geolocation;

// Ad-hoc, scoped to the driver for a single call:
$location = Geolocation::provider('google_places')->locateAddress('Bratislava, Slovakia');
$location = Geolocation::provider('google_places')->locateCoordinates(new Coordinates(48.1486, 17.1077));

echo $location?->humanReadable;
echo $location?->countryIsoCode;

The mapped Location fills humanReadable, street (number plus route), city, region, postalCode, countryIsoCode, latitude and longitude from the first geocoding result. The lookups run through the same client, so caching, rate limits and events apply.

Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

More ways to support, including crypto

By donating, you agree to our donation terms.

Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.