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

ActiveLibrary[Caching](/categories/caching)

playlogiq/laravel-mongodb-cache
===============================

A mongodb cache driver for laravel

03PHP

Since Jun 23Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)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

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/58329979df48b3bc448385c3a0eea2de715013c33576a6b2b8416b0ab010afb2?d=identicon)[PEscar](/maintainers/PEscar)

---

Top Contributors

[![PEscar](https://avatars.githubusercontent.com/u/28983045?v=4)](https://github.com/PEscar "PEscar (4 commits)")

### Embed Badge

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

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

###  Alternatives

[beryllium/cachebundle

Provides an interface to Memcache for Symfony2 applications

33136.2k](/packages/beryllium-cachebundle)

PHPackages © 2026

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