Repository navigation
HTTP API
Set http.enabled to true in the published configuration. Configure http.prefix and http.middleware there; defaults are api/geolookup/v1 and the host's api middleware group. The consuming application owns authentication, authorization, CORS and throttling. The package adds no frontend or alternate server.
GET /api/geolookup/v1
GET /api/geolookup/v1/search?q=Bethel%20Acres%2C%20OK
GET /api/geolookup/v1/search?q=80160&country=TH&types=subdistrict&limit=10
GET /api/geolookup/v1/places/{id}
GET /api/geolookup/v1/places/{id}/children
GET /api/geolookup/v1/places/{id}/ancestors
GET /api/geolookup/v1/reverse?latitude=8.66239&longitude=99.87876&stop_at=subdistrict
GET /api/geolookup/v1/openapi.yamlThe coordinate example needs genuine installed polygons to produce an actual administrative result. Reverse responses contain matching place/resolution branches, report ambiguity, and deduplicate a common requested parent. complete=true means resolution at the requested type (or deepest installed boundary when no type is requested), not complete geographic coverage. An unavailable stop type returns the deepest installed match with complete=false. No matched boundary yields an empty list; it does not establish that the coordinate has no real administrative location.
Package-handled errors always use JSON {error: {code, message, fields}}, including without an Accept header: 422 invalid input, 404 unknown place, 503 unavailable/incompatible data. Host middleware errors remain governed by the application. API responses do not expose local dataset paths or SQL errors.
The API root returns the OpenAPI YAML directly with Content-Type: application/yaml, with or without a trailing slash. /openapi.yaml remains an equivalent alias. Both use the configured prefix and middleware and work without a dataset. After upgrading, rebuild any host route cache with php artisan route:cache. You can also execute php artisan vendor:publish --tag=geolookup-openapi to copy the canonical file to openapi/geolookup.yaml. Static published copies keep the canonical default server URL; configure generated clients with the actual application URL/prefix. See client generation.
The authoritative operation IDs, parameters and response schemas are in the versioned OpenAPI contract. Shared name/postal matching rules and PHP calls are described in the PHP API guide.
by-dolly
