Skip to content

Map latitude/longitude to a timezone without making external API calls

License

Notifications You must be signed in to change notification settings

glhd/laravel-timezone-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Timezone Mapper

This package maps coordinates to a timezone string. Based heavily on TimezoneMapperPHP and LatLongToTimezone and adopted for use in a Laravel project.

It's not likely to be 100% correct every time, but if you need to map lots of coordinates and don't want to make API calls each time, it's a good way to get reasonable defaults.

Usage:

$mapped_timezone = TimezoneMapper::mapCoordinates(
  latitude: 51.50853,
  longitude: -0.12574,
  fallback: 'America/New_York', // Optional -- used if unable to map coords
);

// Returns "Europe/London"

About

Map latitude/longitude to a timezone without making external API calls

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages