PHPackages                             tochka-developers/geo-timezone - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tochka-developers/geo-timezone

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tochka-developers/geo-timezone
==============================

PHP library for timezone calculation from a particular location.

v0.3.0(1y ago)0571MITPHPPHP 8.2.\*|8.3.\*

Since Jun 18Pushed 1y agoCompare

[ Source](https://github.com/tochka-developers/geo-timezone)[ Packagist](https://packagist.org/packages/tochka-developers/geo-timezone)[ RSS](/packages/tochka-developers-geo-timezone/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

Geo-Timezone PHP Library
========================

[](#geo-timezone-php-library)

[![Build Status](https://camo.githubusercontent.com/a6652a143446b174ed628e31cbdcdd30c2ed8c3e19e5d63f0cb5423a651fc333/68747470733a2f2f7472617669732d63692e6f72672f6d696e7562652f67656f2d74696d657a6f6e652e706e67)](https://travis-ci.org/minube/geo-timezone) [![Code Coverage](https://camo.githubusercontent.com/1773142622cea5dacee8b55e12931d854b6aa3ce862272185572b5058d4a5c84/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e7562652f67656f2d74696d657a6f6e652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minube/geo-timezone/?branch=master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/5db77b0a5233cc41fa9d2fb312085a3162e41b25bbb33675c83a54420ba21d29/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e7562652f67656f2d74696d657a6f6e652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minube/geo-timezone/?branch=master) [![Build Status](https://camo.githubusercontent.com/58036dd67aa4c0d149591fdf780ef0c870ec37a131daa908e6a8f4e79b59006d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d696e7562652f67656f2d74696d657a6f6e652f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/minube/geo-timezone/build-status/master)

Based on the [node-geo-tz package](https://github.com/evansiroky/node-geo-tz), this PHP library calculates the timezone associated to a particular location based on coordinates (latitude, longitude) and timestamp reference. Therefore, this library provides the local date of a particular location in any moment too. In addition, it is based on the timezones boundaries extracted by [timezone-boundary-builder](https://github.com/evansiroky/timezone-boundary-builder) tool, so it is necessary to always use the latest version of this package. In order to improve the timezone search through the boundaries, node-geo-tz proposes to create a tree of directories based on dividing the Earth in quadrants and sub-quadrants iteratively. This tree is called "data.zip" in the reference library.

Requirements
------------

[](#requirements)

GEOS PHP extension is needed to run library. So, you should download and compile it running the script bin/compile-geos .sh; then, the library called "geos.so" will be added to /usr/lib/php. As you can see, this script contains the installation of some php extensions that will be necessary in the next step of the installation process.

Once you have compiled the GEOS PHP extension, you should create the file geos.ini in order to enable the module and improve the performance consequently.

Finally, you should run the composer file, so the rest of necessary libraries will be installed.

Usage
-----

[](#usage)

There are two main classes:

- UpdaterData: script that downloads the last version of the timezone boundaries data and creates the tree of directories (data.zip). It takes a few hours, so you can use "data.zip" from node-geo-tz to test for the first time. Otherwise, you can run the UpdaterData script in order to get the last version and create the directories tree. Destination folder must have write permisions

```
use Tochka\GeoTimeZone\UpdaterData;
use Tochka\GeoTimeZone\IndexerWithOptimalReader;

$updater = new UpdaterData('/path/to/base/data/');
$dataPath = $updater->updateData();

$dataRepository = new JsonFileDataRepository($dataPath, '/path/to/index/data/directory');
$indexer = new IndexerWithOptimalReader($dataPath, $dataRepository);
$indexer->index();
```

- Calculator: provides the timezone name or the local date associated to a particular latitude, longitude and timestamp.

```
    use Tochka\GeoTimeZone\TimezoneFinder;
    use Tochka\GeoTimeZone\DataRepository\JsonFileDataRepository;

    $latitude = 39.452800;
    $longitude = -0.347038;
    $timestamp = 1469387760;

    $dataRepository = new JsonFileDataRepository('/path/to/base/data/file.json', '/path/to/index/data/');
    $timezoneFinder = new TimezoneFinder($dataRepository);

    // TimeZone name
    $timeZoneName = $timezoneFinder->findTimezone($latitude, $longitude);
    //Europe/Madrid
```

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance42

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~55 days

Total

5

Last Release

472d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dc33cf2a905842e2b7b452bb04d75ba24943d1c22fcffa8aa393d04c0ba20f3c?d=identicon)[darkdarin](/maintainers/darkdarin)

---

Top Contributors

[![abmo](https://avatars.githubusercontent.com/u/15795778?v=4)](https://github.com/abmo "abmo (115 commits)")[![fjalvarezdd](https://avatars.githubusercontent.com/u/1707308?v=4)](https://github.com/fjalvarezdd "fjalvarezdd (6 commits)")[![JustHarris](https://avatars.githubusercontent.com/u/8626468?v=4)](https://github.com/JustHarris "JustHarris (3 commits)")[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (3 commits)")[![inakivb](https://avatars.githubusercontent.com/u/8626495?v=4)](https://github.com/inakivb "inakivb (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tochka-developers-geo-timezone/health.svg)

```
[![Health](https://phpackages.com/badges/tochka-developers-geo-timezone/health.svg)](https://phpackages.com/packages/tochka-developers-geo-timezone)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
