{"id":48451918,"url":"https://github.com/sysborg/gmaps-laravel","last_synced_at":"2026-04-06T21:02:41.137Z","repository":{"id":341476716,"uuid":"1170243073","full_name":"sysborg/gmaps-laravel","owner":"sysborg","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-01T23:11:24.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-02T01:56:09.159Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sysborg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-01T22:34:46.000Z","updated_at":"2026-03-01T23:05:00.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/sysborg/gmaps-laravel","commit_stats":null,"previous_names":["sysborg/gmaps-laravel"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sysborg/gmaps-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fgmaps-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fgmaps-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fgmaps-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fgmaps-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sysborg","download_url":"https://codeload.github.com/sysborg/gmaps-laravel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sysborg%2Fgmaps-laravel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31489427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T17:22:55.647Z","status":"ssl_error","status_checked_at":"2026-04-06T17:22:54.741Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-06T21:02:26.740Z","updated_at":"2026-04-06T21:02:41.131Z","avatar_url":"https://github.com/sysborg.png","language":"PHP","funding_links":["https://buymeacoffee.com/andmarruda"],"categories":[],"sub_categories":[],"readme":"# sysborg/gmaps-laravel\n\n\u003e A Google Maps API package for Laravel built on **Ports and Adapters (Hexagonal Architecture)** — clean, testable, and designed to grow with your needs.\n\n[![PHP](https://img.shields.io/badge/PHP-8.2%2B-blue)](https://php.net)\n[![Laravel](https://img.shields.io/badge/Laravel-11%2B-red)](https://laravel.com)\n[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n[![Tests](https://img.shields.io/badge/tests-passing-brightgreen)](#testing)\n\n---\n\n## Why this package?\n\nMost Google Maps packages for Laravel expose raw arrays and mix API calls directly into your business logic. This package takes a different approach:\n\n- **Ports and Adapters** — your domain code never talks to Google directly; it depends on interfaces\n- **Typed DTOs** — `readonly` classes with full IDE autocomplete, no more guessing array keys\n- **Built-in cache strategy** — configurable TTL per use case to save money on API calls\n- **Facade + DI** — use whichever style fits your team\n\n---\n\n## Installation\n\n```bash\ncomposer require sysborg/gmaps-laravel\n```\n\nPublish the config:\n\n```bash\nphp artisan vendor:publish --provider=\"Sysborg\\GmapsLaravel\\GmapsServiceProvider\" --tag=\"gmaps-config\"\n```\n\nAdd your API key to `.env`:\n\n```dotenv\nGOOGLE_MAPS_API_KEY=your_key_here\n```\n\n\u003e Make sure the **Places API** is enabled in your [Google Cloud Console](https://console.cloud.google.com).\n\n---\n\n## Usage\n\n### Nearby Places Search\n\nFind all locations within a radius from a geographic point.\n\n**Via Facade:**\n\n```php\nuse Sysborg\\GmapsLaravel\\Facades\\GMap;\nuse Sysborg\\GmapsLaravel\\DTOs\\Coordinate;\n\n$response = GMap::nearbySearch(\n    coordinate: new Coordinate(-23.5505, -46.6333),\n    radius:     1500,           // meters\n    type:       'restaurant',   // optional\n    keyword:    'pizza',        // optional\n);\n\nforeach ($response-\u003eplaces as $place) {\n    echo $place-\u003ename;           // \"Pizzaria Italia\"\n    echo $place-\u003evicinity;       // \"Rua Augusta, 100\"\n    echo $place-\u003erating;         // 4.5\n    echo $place-\u003elocation-\u003elatitude;\n    echo $place-\u003elocation-\u003elongitude;\n}\n\nif ($response-\u003ehasNextPage()) {\n    // fetch next page using $response-\u003enextPageToken\n}\n```\n\n**Via Dependency Injection:**\n\n```php\nuse Sysborg\\GmapsLaravel\\UseCases\\Places\\NearbySearchUseCase;\nuse Sysborg\\GmapsLaravel\\DTOs\\Coordinate;\nuse Sysborg\\GmapsLaravel\\DTOs\\Places\\NearbySearchRequest;\n\nclass FindNearbyRestaurantsAction\n{\n    public function __construct(private readonly NearbySearchUseCase $useCase) {}\n\n    public function handle(float $lat, float $lng): array\n    {\n        $response = $this-\u003euseCase-\u003eexecute(new NearbySearchRequest(\n            coordinate: new Coordinate($lat, $lng),\n            radius:     1500,\n            type:       'restaurant',\n        ));\n\n        return $response-\u003etoArray();\n    }\n}\n```\n\n---\n\n## Cache Strategy\n\nEvery API call is cached by default. The cache key is a deterministic hash of all request parameters — same input always hits the cache.\n\n```dotenv\n# Toggle cache on/off\nGOOGLE_MAPS_CACHE_ENABLED=true\n\n# Use any Laravel cache driver\nGOOGLE_MAPS_CACHE_DRIVER=redis\n\n# TTL per use case (seconds)\nGOOGLE_MAPS_CACHE_NEARBY_TTL=3600\n```\n\nFull config reference at [`config/gmaps.php`](config/gmaps.php).\n\n---\n\n## Architecture\n\n```\nsrc/\n├── Contracts/          ← Ports (pure PHP interfaces, zero framework imports)\n│   ├── Cache/CachePort.php\n│   ├── Http/HttpClientPort.php\n│   └── Places/PlacesPort.php\n├── DTOs/               ← Immutable readonly value objects\n│   ├── Coordinate.php\n│   └── Places/  NearbySearchRequest, PlaceResult, NearbySearchResponse\n├── UseCases/           ← Application layer (depends only on Ports + DTOs)\n│   └── Places/NearbySearchUseCase.php\n├── Adapters/           ← Infrastructure (implements Ports using Laravel/Guzzle)\n│   ├── Cache/LaravelCacheAdapter.php\n│   ├── Http/LaravelHttpAdapter.php\n│   └── Places/GooglePlacesAdapter.php\n├── Facades/GMap.php\n└── GmapsServiceProvider.php\n```\n\n---\n\n## Testing\n\n```bash\ncomposer install\n./vendor/bin/phpunit\n```\n\nAll tests use `Http::fake()` — no real API calls are made.\n\n```\nOK (11 tests, 30 assertions)\n```\n\n---\n\n## Currently Implemented\n\n| Feature | Status |\n|---|---|\n| Places — Nearby Search | ✅ |\n| Cache with TTL per use case | ✅ |\n| Facade + DI integration | ✅ |\n| Typed DTOs (readonly) | ✅ |\n| PHPUnit tests with Http::fake() | ✅ |\n\n---\n\n## Roadmap — Have a need? Open an issue!\n\nThis package is built to grow. The architecture makes it straightforward to add new APIs without touching existing code. If you need any of the below — or something not listed — **open an issue and describe your use case**. Contributions are welcome.\n\n| Feature | Notes |\n|---|---|\n| Places — Text Search | Search by keyword anywhere |\n| Places — Place Details | Full details by `place_id` |\n| Places — Autocomplete | For address/search inputs |\n| Geocoding API | Address ↔ coordinates |\n| Reverse Geocoding | Coordinates → formatted address |\n| Directions API | Routes with waypoints |\n| Distance Matrix | Multi-origin/destination travel time |\n| Static Maps | Generate map image URLs |\n| Elevation API | Altitude for coordinates |\n| Time Zone API | Timezone from coordinates |\n| Roads API | Snap-to-road, speed limits |\n| Pagination helper | Auto-fetch next pages |\n| Multi-page collector | Merge all paginated results automatically |\n\n\u003e **Have a specific need?** [Open an issue](https://github.com/andmarruda/gmaps-laravel/issues) describing what you need and how you plan to use it. The more context you give, the faster it gets implemented.\n\n---\n\n## Contributing\n\n1. Fork the repository\n2. Create a branch: `git checkout -b feat/your-feature`\n3. Follow the existing patterns — one port, one adapter, one use case (see [`docs/plan/architecture.md`](docs/plan/architecture.md))\n4. Write tests with `Http::fake()`\n5. Open a PR\n\n---\n\n## Support the project\n\nIf this package saves you time or reduces your Google Maps API costs, consider buying a coffee.\nIt helps keep this maintained and motivates new features to be added.\n\n[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-%E2%98%95%20Support%20the%20project-yellow?style=for-the-badge\u0026logo=buy-me-a-coffee\u0026logoColor=black)](https://buymeacoffee.com/andmarruda)\n\n---\n\n## License\n\nMIT © [Anderson Arruda](https://github.com/andmarruda)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysborg%2Fgmaps-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsysborg%2Fgmaps-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsysborg%2Fgmaps-laravel/lists"}