https://github.com/benjaminhansen/arcgis-geocode
A PHP library for interacting with the ArcGIS Geocode API.
https://github.com/benjaminhansen/arcgis-geocode
api arcgis geocode php rest suggestion wrapper
Last synced: 3 months ago
JSON representation
A PHP library for interacting with the ArcGIS Geocode API.
- Host: GitHub
- URL: https://github.com/benjaminhansen/arcgis-geocode
- Owner: benjaminhansen
- Created: 2024-07-08T22:46:32.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T20:41:26.000Z (about 1 year ago)
- Last Synced: 2025-09-07T13:32:05.118Z (9 months ago)
- Topics: api, arcgis, geocode, php, rest, suggestion, wrapper
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# PHP Library for the ArcGIS Geocode REST API
Provides an intuitive interface to use the ArcGIS Geocode REST API in any PHP application.
## Installation
```
composer require benjaminhansen/arcgis-geocode
```
## Usage
```php
labelsAsPostalCity()->text('1600 Pennsylvania Ave. SE, Washington, DC 20003');
// get the first suggestion returned
$suggestion = $suggest_request->first();
// or get all suggestions returned
// $suggestions = $suggest_request->all();
// use a suggestion to look up coordinates, etc
$all_candidates = $suggestion->candidates()->all();
$first_candidate = $suggestion->candidates()->first();
$last_candidate = $suggestion->candidates()->last();
// or you can provide the text and magicKey values directly
// $candidates_request = new FindAddressCandidates($suggestion->text, $suggestion->magicKey);
// get the first candidate returned
// $candidate = $candidates_request->first();
// get the lat/lon values from the returned object
$latitude = $first_candidate->latitude();
$longitude = $first_candidate->longitude();
```