glhd / laravel-timezone-mapper
Timezone mapper for Laravel
Installs: 58 430
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=7.1.3
- illuminate/support: *
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- php-coveralls/php-coveralls: ^2.1
- phpunit/phpunit: ^7.3
README
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"