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

ActiveLibrary[Caching](/categories/caching)

nguyenhiep/laravel-cache-garbage-collector
==========================================

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

v2.3(4y ago)033MITPHPPHP &gt;=7.1.0

Since Jan 29Pushed 4y agoCompare

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

READMEChangelog (4)Dependencies (5)Versions (8)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 nguyenhiep/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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~373 days

Recently: every ~139 days

Total

7

Last Release

1520d ago

Major Versions

1.1.0 → v2.02022-03-15

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/5ee7ece29e66e7029d6b12d947a7d9714ae36346f21e92d767cfc797b86949d8?d=identicon)[nguyenhiepvan](/maintainers/nguyenhiepvan)

---

Top Contributors

[![nguyenhiepvan](https://avatars.githubusercontent.com/u/33170716?v=4)](https://github.com/nguyenhiepvan "nguyenhiepvan (7 commits)")[![jdavidbakr](https://avatars.githubusercontent.com/u/25177?v=4)](https://github.com/jdavidbakr "jdavidbakr (1 commits)")

---

Tags

jdavidbakrLaravelCacheGarbageCollector

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/nguyenhiep-laravel-cache-garbage-collector/health.svg)](https://phpackages.com/packages/nguyenhiep-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)[jdavidbakr/laravel-cache-garbage-collector

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

59159.5k](/packages/jdavidbakr-laravel-cache-garbage-collector)[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)

PHPackages © 2026

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