PHPackages                             tobias74/reverse-geocoder-cache - 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. [Caching](/categories/caching)
4. /
5. tobias74/reverse-geocoder-cache

ActiveLibrary[Caching](/categories/caching)

tobias74/reverse-geocoder-cache
===============================

Cache results of a reverse geocoder in PHP

v0.3.1(6y ago)41.2k2MITPHPPHP &gt;=5.3.0CI failing

Since May 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/tobias74/reverse-geocoder-cache)[ Packagist](https://packagist.org/packages/tobias74/reverse-geocoder-cache)[ RSS](/packages/tobias74-reverse-geocoder-cache/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (1)Versions (4)Used By (0)

reverse-geocoder-cache
======================

[](#reverse-geocoder-cache)

Cache for reverse geocoding results
-----------------------------------

[](#cache-for-reverse-geocoding-results)

This "reverse geocoder cache" can be used to cache results of reverse geocoding services like Googles Places or Timezones and thereby reducing the amount of requests made to these services. The accuracy of this cache can be dynamically adjusted by setting the internally used key-size. The key-size determines the size of the tiles in which the results will be placed. Larger key-size will result in lower accuracy. Smaller key-size will make the cache consume more memory at increased accuracy.

Example: Requesting the address of a given latitude-longitude while having a key-size of 1000 meters will most likely return a wrong address, since any previous request to a latitude-longitude-combination within a 1000 meter radius will already have been written into the according tile.

```
error_reporting(E_ALL);
date_default_timezone_set('Europe/Berlin');

spl_autoload_register(function ($class) {
    $prefix = 'ReverseGeocoderCache\\';
    $base_dir = __DIR__ . '/../../src/';
    $len = strlen($prefix);
    if (strncmp($prefix, $class, $len) !== 0) {
        return;
    }
    $relative_class = substr($class, $len);
    $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php';
    if (file_exists($file)) {
        require $file;
    }
});

class RedisCacheMimic
{
  protected $hash=array();

  public function set($key, $value)
  {
    $this->hash[$key] = $value;
  }

  public function get($key)
  {
    return $this->hash[$key];
  }
}

$cacheBackend = new RedisCacheMimic();

// caching googles places

$placesProvider = new \ReverseGeocoderCache\Provider\GooglePlacesProvider();
$placesProvider->setLanguage('en');

$cacheFrontEnd = new \ReverseGeocoderCache\CacheFrontEnd();
$cacheFrontEnd->setKeySize(50);
$cacheFrontEnd->setPrefix('PlacesCache_');
$cacheFrontEnd->setCacheBackend($cacheBackend);

$placesClient = new \ReverseGeocoderCache\CacheClient();
$placesClient->setDataProvider($placesProvider);
$placesClient->setCacheFrontEnd($cacheFrontEnd);

echo '';
echo '';
echo '';

//Albuquerque, N.M
echo $placesClient->get(35.05,-106.39);

// caching googles timezone

$timezonesProvider = new \ReverseGeocoderCache\Provider\GoogleTimezonesProvider();

$cacheFrontEnd = new \ReverseGeocoderCache\CacheFrontEnd();
$cacheFrontEnd->setKeySize(1000);
$cacheFrontEnd->setPrefix('TimezonesCache_');
$cacheFrontEnd->setCacheBackend($cacheBackend);

$timezonesClient = new \ReverseGeocoderCache\CacheClient();
$timezonesClient->setDataProvider($timezonesProvider);
$timezonesClient->setCacheFrontEnd($cacheFrontEnd);

echo '';
echo '';
echo '';

//Albuquerque, N.M
echo $timezonesClient->get(35.05,-106.39);

```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~926 days

Total

3

Last Release

2205d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d43f88c471cdfe22f4e803633d9f1f756f6451923c85c04ed1aad6866f9ccb3?d=identicon)[tobias74](/maintainers/tobias74)

---

Top Contributors

[![tobias74](https://avatars.githubusercontent.com/u/1889785?v=4)](https://github.com/tobias74 "tobias74 (10 commits)")[![marcelo-sf](https://avatars.githubusercontent.com/u/887552?v=4)](https://github.com/marcelo-sf "marcelo-sf (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tobias74-reverse-geocoder-cache/health.svg)

```
[![Health](https://phpackages.com/badges/tobias74-reverse-geocoder-cache/health.svg)](https://phpackages.com/packages/tobias74-reverse-geocoder-cache)
```

PHPackages © 2026

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