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.4(3w ago)60167.1k↓16.3%8MITPHPPHP &gt;=7.1.0CI failing

Since Jan 29Pushed 3w 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 3d ago

READMEChangelog (8)Dependencies (10)Versions (10)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

59

—

FairBetter than 98% of packages

Maintenance94

Actively maintained with recent releases

Popularity46

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~540 days

Recently: every ~371 days

Total

8

Last Release

26d 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://avatars.githubusercontent.com/u/25177?v=4)[J David Baker](/maintainers/jdavidbakr)[@jdavidbakr](https://github.com/jdavidbakr)

---

Top Contributors

[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (3 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

[illuminate/cache

The Illuminate Cache package.

12937.0M1.8k](/packages/illuminate-cache)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.9k1](/packages/mike-bronner-laravel-model-caching)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21111.6k](/packages/iazaran-smart-cache)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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