PHPackages                             marshmallow/laravel-folder-cleaner - 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. marshmallow/laravel-folder-cleaner

ActiveLibrary

marshmallow/laravel-folder-cleaner
==================================

Clean folders using a command. This can be helpful if you have temporary files in your projects that need to be cleaned for saving storage.

v1.4.0(1mo ago)01.8k↓29.6%1MITPHPPHP ^8.1CI passing

Since Oct 11Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/marshmallow-packages/laravel-folder-cleaner)[ Packagist](https://packagist.org/packages/marshmallow/laravel-folder-cleaner)[ Docs](https://github.com/marshmallow/laravel-folder-cleaner)[ RSS](/packages/marshmallow-laravel-folder-cleaner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (26)Versions (8)Used By (0)

Laravel Folder Cleaner
======================

[](#laravel-folder-cleaner)

[![Latest Version on Packagist](https://camo.githubusercontent.com/057b42213fafa4782627be954ffc499e2ce62e2df796e8e780eb63b9f3b40097/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617273686d616c6c6f772f6c61726176656c2d666f6c6465722d636c65616e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/laravel-folder-cleaner)[![GitHub Tests Action Status](https://camo.githubusercontent.com/fec1a2816ce007883c3d364b30bce1cf8b94d65e23cec3a03f38a79791f609fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d617273686d616c6c6f772f6c61726176656c2d666f6c6465722d636c65616e65722f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/marshmallow/laravel-folder-cleaner/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e6497b4a63e00f1fc8019403fc2fb91c325a77d3f6a874db79b9fba73edc99fa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d617273686d616c6c6f772f6c61726176656c2d666f6c6465722d636c65616e65722f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/marshmallow/laravel-folder-cleaner/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/5a8ff139d8b72b08c3273a2e9600b78eb571cd0b94d8e8c33180d15ee3cd23d5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617273686d616c6c6f772f6c61726176656c2d666f6c6465722d636c65616e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/marshmallow/laravel-folder-cleaner)

Clean folders using a command. This can be helpful if you have temporary files in your projects that need to be cleaned for saving storage.

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

[](#installation)

You can install the package via composer:

```
composer require marshmallow/laravel-folder-cleaner
```

You can install the package by running the command below. This installation command will publish a config file where you can let the package know what you wish to delete.

```
php artisan folder-cleaner:install
```

The following config file will now be published.

```
return [

    /**
     * You can specify the folders that should be cleaned in
     * this config array. We will search for these folders
     * in the root directory of you project.
     */
    'folders' => [
        // '/storage/logs',
        // '/storage' => [
        //     'older_than' => '3 months',
        //     'except' => [
        //         'important.log',
        //     ],
        // ],
        // '/storage/app' => [
        //     'older_than' => '1 day',
        //     'match' => '/^export_\d+\.xlsx$/',
        // ],
    ],
];
```

Usage
-----

[](#usage)

```
php artisan folder-cleaner:clean {--dry-run} {--quiet}
```

### Options

[](#options)

In the config file you can specify a couple of settings to let the package know what should be cleaned.

If you just provide a string for a folder, all the files in this folder will be deleted when the command is run. Please not, this doesn't work recursively, folders will not be deleted.

```
return [
    'folders' => [
        // '/storage/logs',
    ]
];
```

You can also specify some settings as an array after the path of the folder. The example below will delete all files that are older then 3 months, match a patern of export\_{number}.xlsx except for export\_1.xlsx.

```
return [
    'folders' => [
        '/storage' => [
            'older_than' => '3 months',
            'match' => '/^export_\d+\.xlsx$/',
            'except' => [
                'export_1.xlsx',
            ],
        ],
    ]
];
```

If you have a directory which holds temporary directories that can deleted with all its content, you can use the `delete_folders` options. In the example below, all files in the download directory AND all sub directories in the download directory will be deleted once they are 7 days old.

```
return [
    'folders' => [
         '/storage/app/public/download' => [
            'delete_folders' => true,
            'older_than' => '7 days',
        ],
    ]
];
```

If you need more options, please let us know. This was enough for our use case at the moment of creating this package.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

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

[](#security-vulnerabilities)

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

Credits
-------

[](#credits)

- [Stef van Esch](https://github.com/marshmallow-packages)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance89

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.4% 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 ~148 days

Recently: every ~222 days

Total

7

Last Release

55d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/be33d2624e24c516e73892b0929447cc762f3622c024ab8d0d2a59042e5d2c7f?d=identicon)[marshmallow](/maintainers/marshmallow)

---

Top Contributors

[![stefvanesch](https://avatars.githubusercontent.com/u/46725619?v=4)](https://github.com/stefvanesch "stefvanesch (29 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

laravelmarshmallowlaravel-folder-cleaner

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/marshmallow-laravel-folder-cleaner/health.svg)

```
[![Health](https://phpackages.com/badges/marshmallow-laravel-folder-cleaner/health.svg)](https://phpackages.com/packages/marshmallow-laravel-folder-cleaner)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[marshmallow/laravel-facebook-webhook

A package to retrieve Facebook Leads with webhooks &amp; Graph API in Laravel.

123.2k](/packages/marshmallow-laravel-facebook-webhook)

PHPackages © 2026

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