Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Google Maps Places Provider

Google Maps Places Provider Laravel Package

geocoder-php/google-maps-places-provider

Google Maps Places provider for the PHP Geocoder library. Lets you geocode and reverse geocode using Google Places/Maps APIs, returning structured location results for addresses and points of interest. Ideal for Laravel/PHP apps needing Places search and lookup.

View on GitHub
Deep Wiki
Context7

[READ ONLY] Provider for GoogleMapsPlaces

Frequently asked questions about Google Maps Places Provider
How do I integrate this Google Maps Places provider into a Laravel app?
Install via Composer (`composer require geocoder-php/google-maps-places-provider`), then configure it in Laravel using GeocoderPHP. Example: `$geocoder = Geocoder::create(['google_maps_places' => ['key' => env('GOOGLE_MAPS_API_KEY')]]);` Bind it to Laravel’s service container for dependency injection.
What Laravel versions does this package support?
This provider works with Laravel 8.x, 9.x, and 10.x, assuming PHP 8.0+. Test with your Laravel LTS version (e.g., 10.x) for stability. PHP 8.2+ is recommended for newer features.
How do I handle Google Places API quotas in production?
Google’s free tier allows 40,000 requests/day. Cache responses in Redis (TTL: 1–24 hours) and implement fallback providers (e.g., OpenStreetMap) for overflow. Monitor usage via Google Cloud Console.
Can I use this for autocomplete/search suggestions in Laravel?
Yes. Use the `geocodeQuery` method with `GoogleMapsPlaces::GEOCODE_MODE_SEARCH` for flexible search results. Example: `$results = $provider->geocodeQuery(GeocodeQuery::create('coffee shop near me')->withData('mode', GoogleMapsPlaces::GEOCODE_MODE_SEARCH));`
What’s the difference between 'find' and 'search' modes?
'Find' mode requires an exact place name and returns a single result (lower cost). 'Search' mode is forgiving but returns all fields (higher cost). Use 'search' for autocomplete or ambiguous queries.
How do I store geocoded data (e.g., latitude/longitude) in Laravel?
Use Eloquent casts like `Geocode` from `geocoder-php/geocoder-laravel` to auto-serialize coordinates. For geospatial queries, pair with PostgreSQL + PostGIS (e.g., `ST_DWithin` for radius searches).
Is there a way to cache responses to reduce API calls?
Yes. Use GeocoderPHP’s built-in caching (e.g., Redis) or Laravel’s cache system. Example: `$geocoder->setCache(new RedisCache());` Set TTLs based on data volatility (e.g., 1 hour for volatile, 24h for static places).
What alternatives exist if Google Maps API costs exceed budget?
Consider OpenStreetMap (`geocoder-php/openstreetmap-provider`), Mapbox, or Nominatim. These are free but may lack Google’s accuracy or structured place data. Test fallbacks with `Geocoder::create([...], 'fallback' => true)`.
How do I handle API errors or rate limits in Laravel?
Implement retry logic with exponential backoff (e.g., using `guzzlehttp/guzzle`). Log errors and notify users if geocoding fails. For rate limits, cache aggressively and monitor Google Cloud alerts.
Does this package support reverse geocoding (coordinates to address)?
Yes. Use the `reverseQuery` method: `$results = $provider->reverseQuery(GeocodeQuery::create(40.714224, -73.961452));` This returns structured place data (e.g., address components, place ID) for the given coordinates.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony