Tiger_Location_Adapter_Interface

@api

Tiger_Location_Adapter_Interface — the capability contract every Location provider implements.

An adapter declares which of the four operations it can do via capabilities(); the Tiger_Location facade only calls an operation on an adapter that supports it (else it throws Tiger_Location_Exception). Every operation returns Tiger_Location_Place(s), so the payload is identical regardless of provider (AWS Location Service, Nominatim/OSM, Google, Mapbox, an IP-geolocation vendor, …). Extend Tiger_Location_Adapter_Abstract rather than implementing this directly — it defaults every op to "unsupported" so you override only what you actually provide.

Methods

capabilities()

capabilities(): array

The CAP_* operations this adapter supports.

Returns array — the CAP_* operations this adapter supports

suggest()

suggest(string $query, array $opts = []): array

Autocomplete a partial address. Returns Tiger_Location_Place[] — usually id + label (call geocode()/retrieve on a selection for the full structure, or the provider may already include it).

  • $query string — the partial address text
  • $opts array — provider options

Returns array

geocode()

geocode(string $query, array $opts = []): array

Geocode free text to structured address(es) with coordinates.

  • $query string — the address text to geocode
  • $opts array — provider options

Returns array

reverse()

reverse(float $lat, float $lng, array $opts = []): ?Tiger_Location_Place

Reverse-geocode coordinates to the nearest address.

  • $lat float — the latitude
  • $lng float — the longitude
  • $opts array — provider options

Returns ?Tiger_Location_Place — the nearest place, or null when unplaceable

ip()

ip(string $ip, array $opts = []): ?Tiger_Location_Place

Approximate location for an IP address.

  • $ip string — the IP address to look up
  • $opts array — provider options

Returns ?Tiger_Location_Place — the place, or null when unplaceable