PHPackages                             geocoder-php/cache-provider - 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. geocoder-php/cache-provider

ActiveLibrary[Caching](/categories/caching)

geocoder-php/cache-provider
===========================

Cache the result of a provider

4.5.0(1y ago)71.4M—7.8%38MITPHPPHP ^8.0CI failing

Since Jun 30Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/geocoder-php/cache-provider)[ Packagist](https://packagist.org/packages/geocoder-php/cache-provider)[ Docs](http://geocoder-php.org/Geocoder/)[ RSS](/packages/geocoder-php-cache-provider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (8)Used By (8)

Cache provider
==============

[](#cache-provider)

[![Build Status](https://camo.githubusercontent.com/a9c8b0fc595f89109ea5c9c44d10b5859df0a5a2bf47a936f08070fc88ee03c8/68747470733a2f2f7472617669732d63692e6f72672f67656f636f6465722d7068702f63616368652d70726f76696465722e7376673f6272616e63683d6d6173746572)](http://travis-ci.org/geocoder-php/cache-provider)[![Latest Stable Version](https://camo.githubusercontent.com/8a8974ed2adb3c49ca5e56f5e1a6a8079af0f7012ae7401e33137e09e8f63699/68747470733a2f2f706f7365722e707567782e6f72672f67656f636f6465722d7068702f63616368652d70726f76696465722f762f737461626c65)](https://packagist.org/packages/geocoder-php/cache-provider)[![Total Downloads](https://camo.githubusercontent.com/bba3f106a5bb54f997b9de44eee0ab63fc63748be6184ec61c32de86e3b095b7/68747470733a2f2f706f7365722e707567782e6f72672f67656f636f6465722d7068702f63616368652d70726f76696465722f646f776e6c6f616473)](https://packagist.org/packages/geocoder-php/cache-provider)[![Monthly Downloads](https://camo.githubusercontent.com/2593b49aec68cde4603058e862e080258f0ca5e2d5a5e1d34f49d15e48ef11ca/68747470733a2f2f706f7365722e707567782e6f72672f67656f636f6465722d7068702f63616368652d70726f76696465722f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/geocoder-php/cache-provider)[![Code Coverage](https://camo.githubusercontent.com/3902c74d0a23d2988260975e9ab063823583ab8bc02dab870eaebddd88dfdb5c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f67656f636f6465722d7068702f63616368652d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/geocoder-php/cache-provider)[![Quality Score](https://camo.githubusercontent.com/5b908464b4a230aa9e938b3e48ed5d6926007c5f9b9fc67490553d75928b9b83/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f67656f636f6465722d7068702f63616368652d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/geocoder-php/cache-provider)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

This is the a cache provider from the PHP Geocoder. This is a **READ ONLY** repository. See the [main repo](https://github.com/geocoder-php/Geocoder) for information and documentation.

### Install

[](#install)

```
composer require geocoder-php/cache-provider
```

### Usage

[](#usage)

The `ProviderCache` allows you to use any [PSR-6](https://www.php-fig.org/psr/psr-6/) compatible cache driver. You can find compatible drivers on [packagist](https://packagist.org/providers/psr/cache-implementation).

By default, the result is cached forever. You can set a cache expiry by passing an integer representing the number of seconds as the third parameter.

```
$httpClient = new \Http\Discovery\Psr18Client();
$provider = new \Geocoder\Provider\GoogleMaps\GoogleMaps($httpClient);

$psr6Cache = new ArrayCachePool(); // Requires `cache/array-adapter` package

$cachedProvider = new \Geocoder\Provider\Cache\ProviderCache(
    $provider, // Provider to cache
    $psr6Cache, // PSR-6 compatible cache
    600 // Cache expiry, in seconds
);

$geocoder = new \Geocoder\StatefulGeocoder($cachedProvider, 'en');

// Will come from Google Maps API
$result1 = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));
// Will come from the cache
$result2 = $geocoder->geocodeQuery(GeocodeQuery::create('Buckingham Palace, London'));
```

### Contribute

[](#contribute)

Contributions are very welcome! Send a pull request to the [main repository](https://github.com/geocoder-php/Geocoder) or report any issues you find on the [issue tracker](https://github.com/geocoder-php/Geocoder/issues).

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance59

Moderate activity, may be stable

Popularity47

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~474 days

Recently: every ~646 days

Total

7

Last Release

398d ago

PHP version history (5 changes)4.0.0PHP ^7.0

4.2.0PHP ^7.2

4.3.0PHP ^7.3 || ^8.0

4.4.0PHP ^7.4 || ^8.0

4.5.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/401ccc5eea13c60cf807ae982af00e368e2166e2f26d8eb541dcd881a57385bc?d=identicon)[Nyholm](/maintainers/Nyholm)

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

---

Top Contributors

[![jbelien](https://avatars.githubusercontent.com/u/1150563?v=4)](https://github.com/jbelien "jbelien (18 commits)")[![Chris53897](https://avatars.githubusercontent.com/u/7104259?v=4)](https://github.com/Chris53897 "Chris53897 (6 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (6 commits)")[![cookieguru](https://avatars.githubusercontent.com/u/1888809?v=4)](https://github.com/cookieguru "cookieguru (2 commits)")[![norkunas](https://avatars.githubusercontent.com/u/2722872?v=4)](https://github.com/norkunas "norkunas (2 commits)")[![JaZo](https://avatars.githubusercontent.com/u/3475007?v=4)](https://github.com/JaZo "JaZo (1 commits)")[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (1 commits)")[![gnumoksha](https://avatars.githubusercontent.com/u/696797?v=4)](https://github.com/gnumoksha "gnumoksha (1 commits)")[![AntoineLemaire](https://avatars.githubusercontent.com/u/2025537?v=4)](https://github.com/AntoineLemaire "AntoineLemaire (1 commits)")[![nicolas-grekas](https://avatars.githubusercontent.com/u/243674?v=4)](https://github.com/nicolas-grekas "nicolas-grekas (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/geocoder-php-cache-provider/health.svg)

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

###  Alternatives

[laminas/laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

1076.9M130](/packages/laminas-laminas-cache)[cache/adapter-common

Common classes for PSR-6 adapters

11124.4M38](/packages/cache-adapter-common)[cache/filesystem-adapter

A PSR-6 cache implementation using filesystem. This implementation supports tags

705.8M82](/packages/cache-filesystem-adapter)[cache/array-adapter

A PSR-6 cache implementation using a php array. This implementation supports tags

548.3M151](/packages/cache-array-adapter)[cache/redis-adapter

A PSR-6 cache implementation using Redis (PhpRedis). This implementation supports tags

523.9M27](/packages/cache-redis-adapter)[cache/simple-cache-bridge

A PSR-6 bridge to PSR-16. This will make any PSR-6 cache compatible with SimpleCache.

423.1M27](/packages/cache-simple-cache-bridge)

PHPackages © 2026

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