PHPackages                             luewell/laravel-mongodb-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. luewell/laravel-mongodb-cache

ActiveLibrary[Caching](/categories/caching)

luewell/laravel-mongodb-cache
=============================

A mongodb cache driver for laravel

02PHP

Since Aug 23Pushed 5y agoCompare

[ Source](https://github.com/luewell/laravel-mongodb-cache)[ Packagist](https://packagist.org/packages/luewell/laravel-mongodb-cache)[ RSS](/packages/luewell-laravel-mongodb-cache/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Mongodb Cache driver
============================

[](#laravel-mongodb-cache-driver)

A MongoDB cache driver for Laravel

Installation
------------

[](#installation)

Install using composer:

```
composer require 1ff/laravel-mongodb-cache

```

If you are using Laravel older than 5.5 add the service provider in `config/app.php`:

```
'ForFit\Mongodb\Cache\ServiceProvider::class',

```

Add the mongodb cache store in `config/cache.php`

```
'stores' => [
    ...

    'mongodb' => [
        'driver' => 'mongodb',
        'table' => 'cache', // name it as you wish
        'connection' => 'mongodb',
    ],
],

```

Update your .env file and change the `CACHE_DRIVER` to mongodb

```
CACHE_DRIVER=mongodb

```

Advantages
----------

[](#advantages)

- This driver uses the [MongoDB TTL indexes](https://docs.mongodb.com/manual/core/index-ttl/) meaning when a cache key expires it will be automatically deleted.
- This way, the collection's size will remain around the size you expect and won't get falsely filled with unused data.
- The package automatically adds a migration which creates the index by running a mongodb command.
- This package also registers two new commands:

    ```
      php artisan mongodb:cache:index

    ```

    and

    ```
      php artisan mongodb:cache:dropindex

    ```

Warning
-------

[](#warning)

This cache driver is not compatible with other cache drivers because it encodes the data differently. If you are using another mongodb cache driver at the moment make sure you set a new collection for this one.

Enjoy!
------

[](#enjoy)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49596554?v=4)[Luewell](/maintainers/luewell)[@luewell](https://github.com/luewell)

---

Top Contributors

[![t1sh0o](https://avatars.githubusercontent.com/u/3911728?v=4)](https://github.com/t1sh0o "t1sh0o (7 commits)")[![vcrazy](https://avatars.githubusercontent.com/u/545351?v=4)](https://github.com/vcrazy "vcrazy (7 commits)")[![isluewell](https://avatars.githubusercontent.com/u/49596542?v=4)](https://github.com/isluewell "isluewell (4 commits)")[![spont4e](https://avatars.githubusercontent.com/u/10523455?v=4)](https://github.com/spont4e "spont4e (2 commits)")

### Embed Badge

![Health badge](/badges/luewell-laravel-mongodb-cache/health.svg)

```
[![Health](https://phpackages.com/badges/luewell-laravel-mongodb-cache/health.svg)](https://phpackages.com/packages/luewell-laravel-mongodb-cache)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

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