Search by

roundly-consulting / google-places-for-laravel

mihaliak

Query the Google Places API — place details, autocomplete, reverse geocoding, and distance matrix — from Laravel.

Package info

github.com/roundly-consulting/google-places-for-laravel

pkg:composer/roundly-consulting/google-places-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:40 UTC

This package is auto-updated.

Last update: 2026-10-03 18:54:25 UTC


README

Google Places for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

Google Places for Laravel

Google's Places API (New), Routes API and Geocoding API from Laravel: autocomplete, place details, text and nearby search, geocoding, distances and photos through one typed client with fluent query objects, field masks, caching, rate limiting and a first-class fake for tests.

Installation

Requires PHP 8.4, Laravel 12 or 13, and a Google Maps Platform API key with the Places API (New), Routes API and Geocoding API enabled.

composer require roundly-consulting/google-places-for-laravel

Set GOOGLE_PLACES_API_KEY in .env; without it, calls throw PlacesException before any request is sent.

Usage

Suggest places while the user types, then look up the chosen one:

use RoundlyConsulting\GooglePlaces\Facades\GooglePlaces;

$predictions = GooglePlaces::autocomplete('Luxury Restaurant');   // Collection<AutocompletePrediction>

$place = GooglePlaces::details($predictions->first()->placeId);   // ?Place

$place->name;
$place->formattedAddress;
$place->coordinates();                                            // ?Location
$place->isOpenNow();

$photoUrl = GooglePlaces::photo($place->photos[0], maxWidth: 800)->url(); // key-free, safe for the browser

Search with filters and measure the trip:

use RoundlyConsulting\GooglePlaces\DataTransferObjects\{DistanceQuery, Location, TextSearchQuery};
use RoundlyConsulting\GooglePlaces\Enums\TravelMode;

$brunch = GooglePlaces::textSearch(
    (new TextSearchQuery('vegan brunch'))->openNow()->withMinRating(4.0)->take(10),
);                                                                // Collection<Place>

$trip = GooglePlaces::distance(new DistanceQuery(
    from: new Location(48.1486, 17.1077),                         // Bratislava
    to: new Location(48.2082, 16.3738),                           // Vienna
    type: TravelMode::Driving,
));

$trip->humanReadableDistance;                                     // "79.8 km"
$trip->humanReadableDuration;                                     // "1h 5m"

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/google-places-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

The MIT License (MIT). Please see License File for more information.