PHPackages                             jdavidbakr/laravel-cache-garbage-collector - 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. jdavidbakr/laravel-cache-garbage-collector

ActiveLibrary[Caching](/categories/caching)

jdavidbakr/laravel-cache-garbage-collector
==========================================

A script that will clean up expired cache files if the system is using the files cache system

2.3(1y ago)59159.5k↑13.8%8[1 PRs](https://github.com/jdavidbakr/laravel-cache-garbage-collector/pulls)MITPHPPHP &gt;=7.1.0

Since Jan 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jdavidbakr/laravel-cache-garbage-collector)[ Packagist](https://packagist.org/packages/jdavidbakr/laravel-cache-garbage-collector)[ Docs](https://github.com/jdavidbakr/LaravelCacheGarbageCollector)[ RSS](/packages/jdavidbakr-laravel-cache-garbage-collector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (5)Versions (9)Used By (0)

LaravelCacheGarbageCollector
============================

[](#laravelcachegarbagecollector)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1ac5770fe97f7afbfc037eb75007aa89ffbf64de5257a87a91792368be10a9fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a646176696462616b722f6c61726176656c2d63616368652d676172626167652d636f6c6c6563746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jdavidbakr/laravel-cache-garbage-collector)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/de4cbb3c966575bf3cd15f68c49b6f2431d510b151c939fe5dd385c62a530c94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a646176696462616b722f6c61726176656c2d63616368652d676172626167652d636f6c6c6563746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jdavidbakr/laravel-cache-garbage-collector)[![Travis CI](https://camo.githubusercontent.com/5c5d2dac21065257a6e44985301574fc64b7a335125196b25ceea5fb81477598/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a646176696462616b722f6c61726176656c2d63616368652d676172626167652d636f6c6c6563746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/jdavidbakr/laravel-cache-garbage-collector)

When using the file cache driver, Laravel creates the cache files but never purges expired ones. This can lead to a situation where you have a large number of unused and irrelevant cache files, especially if you do a lot of short-term caching in your system.

This package creates an artisan command cache:gc that will garbage-collect your cache files, removing any that have expired. You may run this manually or include it in a schedule.

Thanks to [TerrePorter](http://laravel.io/user/TerrePorter) for his suggestion on [laravel.io](http://laravel.io/forum/01-28-2016-cache-file-garbage-collection)!

Install
-------

[](#install)

Via Composer

```
$ composer require jdavidbakr/laravel-cache-garbage-collector
```

Then add the service provider to `app/Console/Kernel.php` in the $commands array:

```
\jdavidbakr\LaravelCacheGarbageCollector\LaravelCacheGarbageCollector::class
```

Usage
-----

[](#usage)

```
$ php artisan cache:gc
```

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

[](#contributing)

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

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Jon Baker](https://github.com/jdavidbakr)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance43

Moderate activity, may be stable

Popularity46

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~406 days

Total

7

Last Release

454d ago

Major Versions

1.1.0 → 2.02022-05-13

PHP version history (2 changes)1.0PHP &gt;=5.4.0

1.1.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/28fc80e04726581ef8fd2cda5300c45a22d67437c62bbaa7be372feb46256640?d=identicon)[jdavidbakr](/maintainers/jdavidbakr)

---

Top Contributors

[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![jdavidbakr](https://avatars.githubusercontent.com/u/25177?v=4)](https://github.com/jdavidbakr "jdavidbakr (1 commits)")[![jonb-sf](https://avatars.githubusercontent.com/u/178495300?v=4)](https://github.com/jonb-sf "jonb-sf (1 commits)")

---

Tags

jdavidbakrLaravelCacheGarbageCollector

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jdavidbakr-laravel-cache-garbage-collector/health.svg)

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[laragear/cache-query

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

272122.8k](/packages/laragear-cache-query)[namoshek/laravel-redis-sentinel

An extension of Laravels Redis driver which supports connecting to a Redis master through Redis Sentinel.

38679.0k](/packages/namoshek-laravel-redis-sentinel)

PHPackages © 2026

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