### Install package with Composer Source: https://github.com/roundly-consulting/google-places-for-laravel/blob/main/README.md Run this command to install the package. 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. Set GOOGLE_PLACES_API_KEY in .env; without it, calls throw PlacesException before any request is sent. ```bash composer require roundly-consulting/google-places-for-laravel ``` -------------------------------- ### Autocomplete and place details with GooglePlaces facade Source: https://github.com/roundly-consulting/google-places-for-laravel/blob/main/README.md Use the GooglePlaces facade to autocomplete a query, fetch details for the first prediction, access place properties, and generate a photo URL. The photo URL is key-free and safe for the browser. ```php use RoundlyConsulting\GooglePlaces\Facades\GooglePlaces; $predictions = GooglePlaces::autocomplete('Luxury Restaurant'); // Collection $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 ``` -------------------------------- ### Text search and distance calculation with query objects Source: https://github.com/roundly-consulting/google-places-for-laravel/blob/main/README.md Perform a text search with filters (open now, minimum rating, limit) and calculate driving distance between two locations. The distance result provides human-readable distance and duration strings. ```php 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 $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" ```