Download the PHP package illuma-law/laravel-places-scout without Composer
On this page you can find all versions of the php package illuma-law/laravel-places-scout. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download illuma-law/laravel-places-scout
More information about illuma-law/laravel-places-scout
Files in illuma-law/laravel-places-scout
Package laravel-places-scout
Short Description A fluent Laravel package for interacting with the Google Places API with strongly typed DTOs.
License MIT
Homepage https://github.com/illuma-law/laravel-places-scout
Informations about the package laravel-places-scout
Laravel Places Scout
A fluent Laravel package for interacting with the Google Places API using strictly typed DTOs.
Places Scout acts as a dedicated abstraction over the Google Maps Places API. Instead of dealing directly with raw HTTP requests and unstructured JSON arrays, this package provides an elegant, object-oriented API that maps Google's responses directly into fully typed PHP 8.3 Data Transfer Objects (DTOs) with IDE autocompletion out of the box.
Features
- Text Search: Search for places using natural text queries with automatic pagination support.
- Place Details: Retrieve highly detailed information (phone, website, coordinates) about specific places using their Place ID.
- Strongly Typed DTOs: Immutable,
readonlydata transfer objects ensure data integrity. - Fluent Interface: Clean, chainable API via Facade or Dependency Injection.
- Multi-Tenant Friendly: Supports overriding API keys on the fly.
- Graceful Error Handling: Suppresses exceptions on failed API requests (logging them instead) and returns
null, preventing your application from crashing due to third-party API instability.
Installation
You can install the package via composer:
Publish the configuration file:
Configuration
Add your Google Places API key to your .env file:
The published config/places-scout.php will use this key automatically:
Usage & Integration
Text Search
Search for places using a text query. It returns a PlaceSearchResponse DTO containing an array of PlaceSearchResult DTOs.
Place Details
Get detailed information about a specific place using its place_id. Returns a PlaceDetails DTO.
Dynamic API Keys (Multi-tenant support)
If your application allows users to provide their own Google Maps API credentials, you can override the default API key fluently per-request:
Dependency Injection
Instead of the Facade, you can inject the PlacesScoutService directly into your controllers or jobs:
Testing
The package includes a comprehensive Pest test suite and requires 100% test coverage.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-places-scout with dependencies
illuminate/contracts Version ^11.0||^12.0||^13.0
illuminate/database Version ^11.0||^12.0||^13.0
illuminate/http Version ^11.0||^12.0||^13.0
illuminate/support Version ^11.0||^12.0||^13.0
spatie/laravel-package-tools Version ^1.19