Repository navigation
PHP API
use Moztopia\GeoLookup\GeoLookup;
$geo = app(GeoLookup::class);
$geo->search('Bethel Acres, OK');
$geo->search('Thaiburi, Thailand', types: ['subdistrict']);
$geo->search('80160', country: 'TH', limit: 10, offset: 0);
$geo->search('Thai', within: $thailandId);
$geo->place($placeId);
$geo->children($placeId, limit: 10);
$geo->ancestors($placeId);
$geo->reverse(latitude: $latitude, longitude: $longitude, stopAt: 'country');Every place can be a final selection, including countries and nodes with children. Ancestors run country-to-parent, excluding self; hierarchy includes self. Types are country-specific identifiers, not a global numeric depth. PHP methods return the same envelope as HTTP and throw Exceptions\LookupException for domain/validation failures.
Search folds case, separators and Latin accents while preserving native-script names; known transliterations/spellings should be included as aliases. All typed fragments must match indexed name/alias/ancestor context, or the compact query must match a directly associated postal prefix. Postal spaces/punctuation are ignored for matching. Ranking: exact postal, postal prefix, exact own name/alias, then other indexed name/context matches. Ties use name and UUID. No fuzzy typo-correction guarantee is made.
Search and children return data plus meta.limit, offset, has_more, and next_offset; limit is 1–100, a nonnegative integer offset (bounded by the server's integer range). Results are deterministic for a fixed immutable dataset. An empty result is distinct from a missing dataset or unknown place.
by-dolly
