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

ActiveLibrary[Caching](/categories/caching)

ebethus/mongodb-laravel-cache
=============================

A mongodb cache driver for laravel

0.1.3(2y ago)027MITPHP

Since Jun 30Pushed 2y agoCompare

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

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

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

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

A MongoDB cache driver for Laravel

**Laravel
Version****Package
Version****Install using
this command**5.7.x2.11.xcomposer require 1ff/laravel-mongodb-cache:~2.11.05.8.x, 6.x2.12.xcomposer require 1ff/laravel-mongodb-cache:~2.12.07.x3.x.xcomposer require 1ff/laravel-mongodb-cache:^3.18.x4.x.xcomposer require 1ff/laravel-mongodb-cache:^4.19.x5.x.xcomposer require 1ff/laravel-mongodb-cache:^5.0Installation
------------

[](#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',
    ],
],

```

Add the mongodb database connection in `config/database.php`

```
'connections' => [
    ...

    'mongodb' => [
        'driver' => 'mongodb',
        'dsn' => env('MONGODB_DSN'),
        'database' => env('MONGODB_DATABASE'),
    ],
],

```

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

```
CACHE_DRIVER=mongodb
MONGODB_DSN=mongodb://localhost:27017/laravel
MONGODB_DATABASE=laravel

```

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

19

—

LowBetter than 11% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity35

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.

###  Release Activity

Cadence

Every ~9 days

Total

3

Last Release

980d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/25f561a3fd260935cc3ea5dc049b4ff598c37408dfdbbc129d091221de6c2954?d=identicon)[alb\_be](/maintainers/alb_be)

---

Top Contributors

[![t1sh0o](https://avatars.githubusercontent.com/u/3911728?v=4)](https://github.com/t1sh0o "t1sh0o (11 commits)")[![spont4e](https://avatars.githubusercontent.com/u/10523455?v=4)](https://github.com/spont4e "spont4e (10 commits)")[![bethuxs](https://avatars.githubusercontent.com/u/191869?v=4)](https://github.com/bethuxs "bethuxs (7 commits)")[![vcrazy](https://avatars.githubusercontent.com/u/545351?v=4)](https://github.com/vcrazy "vcrazy (7 commits)")[![tuseto](https://avatars.githubusercontent.com/u/9108143?v=4)](https://github.com/tuseto "tuseto (4 commits)")[![koprinski](https://avatars.githubusercontent.com/u/28507711?v=4)](https://github.com/koprinski "koprinski (2 commits)")

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k7.9M43](/packages/spatie-laravel-responsecache)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.7M22](/packages/genealabs-laravel-model-caching)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.3k109.0k1](/packages/mikebronner-laravel-model-caching)[monospice/laravel-redis-sentinel-drivers

Redis Sentinel integration for Laravel and Lumen.

103826.2k](/packages/monospice-laravel-redis-sentinel-drivers)[laragear/cache-query

Remember your query results using only one method. Yes, only one.

271115.1k](/packages/laragear-cache-query)[overtrue/laravel-passport-cache-token

Make laravel/passport token cacheable.

89271.1k3](/packages/overtrue-laravel-passport-cache-token)

PHPackages © 2026

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