PHPackages                             giacomomasseron/laravel-cache-when-db - 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. [Database &amp; ORM](/categories/database)
4. /
5. giacomomasseron/laravel-cache-when-db

ActiveLibrary[Database &amp; ORM](/categories/database)

giacomomasseron/laravel-cache-when-db
=====================================

Register cache you want to clean when something happens in the database

v1.0.2(1y ago)12[1 PRs](https://github.com/giacomomasseron/laravel-cache-when-db/pulls)MITPHPPHP ^8.2CI passing

Since Nov 3Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/giacomomasseron/laravel-cache-when-db)[ Packagist](https://packagist.org/packages/giacomomasseron/laravel-cache-when-db)[ Docs](https://github.com/giacomomasseron/laravel-cache-when-db)[ GitHub Sponsors]()[ RSS](/packages/giacomomasseron-laravel-cache-when-db/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (6)Used By (0)

Clean cache when something happens in the database
==================================================

[](#clean-cache-when-something-happens-in-the-database)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5775aa0847c03c611d0ff7caa01abd1793702c02c9eca87d5de5d55e57d4d81f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676961636f6d6f6d61737365726f6e2f6c61726176656c2d63616368652d7768656e2d64622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/giacomomasseron/laravel-cache-when-db)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ae28a9aa4fef71ff7a244ce7fd58d4c7b0746d40129e4ef1c05e13bb4628b2dd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f676961636f6d6f6d61737365726f6e2f6c61726176656c2d63616368652d7768656e2d64622f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/giacomomasseron/laravel-cache-when-db/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/810886cf82f2cab3ec550a166bdf782edbf1864e9ed3fe55383209a148cd7fd1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f676961636f6d6f6d61737365726f6e2f6c61726176656c2d63616368652d7768656e2d64622f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/giacomomasseron/laravel-cache-when-db/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/203a7fddf192ac4fdf2d733e8a4e8136a5216b0efd0ea624fde1f9e52e9690d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676961636f6d6f6d61737365726f6e2f6c61726176656c2d63616368652d7768656e2d64622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/giacomomasseron/laravel-cache-when-db)

Clean cache keys when you insert, update or delete some records of your database.

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

[](#installation)

You can install the package via composer:

```
composer require giacomomasseron/laravel-cache-when-db
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-cache-when-db"
```

This is the contents of the published config file:

```
    /*
    |--------------------------------------------------------------------------
    | Cache keys
    |--------------------------------------------------------------------------
    |
    | Define Cache keys to clean when one of the tables of the array changes
    | [
    |      'cache_key' => [
    |          'database_table',
    |          'database_table',
    |      ],
    |
    */
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Giacomo Masseroni](https://github.com/giacomomasseron)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance69

Regular maintenance activity

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~29 days

Total

3

Last Release

495d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/504902576948b6d89fe41cd186b483afa89cc9de1b238005a5b7dcc51d33997e?d=identicon)[giacomomasseron](/maintainers/giacomomasseron)

---

Top Contributors

[![giacomomasseron](https://avatars.githubusercontent.com/u/16156317?v=4)](https://github.com/giacomomasseron "giacomomasseron (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

cachedatabaselaravellaraveleloquentGiacomo Masseronilaravel-cache-when-db

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/giacomomasseron-laravel-cache-when-db/health.svg)

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

###  Alternatives

[silber/bouncer

Eloquent roles and abilities.

3.6k4.4M25](/packages/silber-bouncer)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17649.9k](/packages/lacodix-laravel-model-filter)[giacomomasseron/laravel-models-generator

Generate Laravel models from an existing database

484.2k](/packages/giacomomasseron-laravel-models-generator)

PHPackages © 2026

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