PHPackages                             omaralalwi/laravel-trash-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. omaralalwi/laravel-trash-cleaner

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

omaralalwi/laravel-trash-cleaner
================================

Clean Laravel debug/log files (Debugbar, Clockwork), compiled views and frontend build artifacts, with optional rebuild and scheduling.

1.0.4(1y ago)216.0k2[1 issues](https://github.com/omaralalwi/laravel-trash-cleaner/issues)MITPHPPHP ^7.4|^8.1|^8.2|^8.3|^8.4

Since Jun 8Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/omaralalwi/laravel-trash-cleaner)[ Packagist](https://packagist.org/packages/omaralalwi/laravel-trash-cleaner)[ Docs](https://github.com/omaralalwi/laravel-trash-cleaner)[ RSS](/packages/omaralalwi-laravel-trash-cleaner/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (5)DependenciesVersions (10)Used By (0)

Laravel Trash Cleaner
=====================

[](#laravel-trash-cleaner)

 [ ![Laravel Trash Cleaner](https://raw.githubusercontent.com/omaralalwi/laravel-trash-cleaner/master/public/images/laravel-trash-cleaner.jpg) ](https://github.com/omaralalwi/laravel-trash-cleaner)

 [![Latest Version on Packagist](https://camo.githubusercontent.com/35da5a175e34174172a3774f250a627ac72413500450d1b2827c88c19b33ddc2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6d6172616c616c77692f6c61726176656c2d74726173682d636c65616e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omaralalwi/laravel-trash-cleaner) [![Total Downloads](https://camo.githubusercontent.com/a75fa819992ed40451490f57c41a9c6a9cdcdf0dd27449ba24e035d6c2e47023/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6d6172616c616c77692f6c61726176656c2d74726173682d636c65616e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omaralalwi/laravel-trash-cleaner) [![PHP Version](https://camo.githubusercontent.com/6f44ddbc8ef8f916d4f45d7e840fe7a281633b913ed405549157be54b0f6957f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f6d6172616c616c77692f6c61726176656c2d74726173682d636c65616e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/omaralalwi/laravel-trash-cleaner) [![License](https://camo.githubusercontent.com/a9c7adb9569009fcd5725b87b2bd3af37b6ffaad3490c6eccb835efd3cc51a45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6d6172616c616c77692f6c61726176656c2d74726173682d636c65616e65722e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

**Laravel Trash Cleaner** is a lightweight and powerful utility package that helps you keep your Laravel application clean and performant by:

- 🧹 Deleting debug files (Debugbar, Clockwork) from `storage/`.
- ⚡ Clearing compiled view caches and frontend build directories.
- 🛠️ Optionally rebuilding frontend assets using tools like `npm`, `yarn`, or `pnpm`.
- ⏰ Optionally scheduling automatic cleanup via Laravel's scheduler.

[![Trash Cleaner Screenshot](https://raw.githubusercontent.com/omaralalwi/laravel-trash-cleaner/master/public/images/trash-screen-shot.png)](https://raw.githubusercontent.com/omaralalwi/laravel-trash-cleaner/master/public/images/trash-screen-shot.png)

[![Trash Assets Cleaner Screenshot](https://raw.githubusercontent.com/omaralalwi/laravel-trash-cleaner/master/public/images/trash-assets-screen-shot.png)](https://raw.githubusercontent.com/omaralalwi/laravel-trash-cleaner/master/public/images/trash-assets-screen-shot.png)

---

📋 Table of Contents
-------------------

[](#-table-of-contents)

- [Requirements](#-requirements)
- [Installation](#-installation)
- [Usage](#-usage)
- [Configuration](#-configuration)
- [Scheduling Automatic Cleanup](#-scheduling-automatic-cleanup)
- [Contributing](#-contributing)
- [Security](#%EF%B8%8F-security)
- [License](#-license)
- [Helpful Open Source Packages](#-helpful-open-source-packages)

---

✅ Requirements
--------------

[](#-requirements)

- **PHP** `7.4` or `8.1+` (`^7.4 | ^8.1 | ^8.2 | ^8.3 | ^8.4`)
- **Laravel** `8.x` or higher
- A **Unix-like environment** (Linux/macOS) for `trash:clean-assets`, which uses `rm` and your Node package manager. See the [note below](#-clean-asset-folders).

---

🚀 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require omaralalwi/laravel-trash-cleaner
```

### 🔧 Publish Configuration

[](#-publish-configuration)

Optionally, publish the configuration file to customize paths and build settings (see [Configuration](#-configuration)):

```
php artisan vendor:publish --tag=laravel-trash-cleaner
```

---

🧹 Usage
-------

[](#-usage)

### 🔸 Clean Debug Files

[](#-clean-debug-files)

Deletes the `.json` debug files from the `storage/debugbar` and `storage/clockwork` folders with a progress bar, and reports how much disk space was freed:

```
php artisan trash:clean
```

### 🔸 Clean Asset Folders

[](#-clean-asset-folders)

Removes frontend-related build caches and compiled view files based on your config (see [`cleanup_paths`](#-configuration)):

```
php artisan trash:clean-assets
```

> **Note:** `trash:clean-assets` runs `rm -rf` and your Node package manager under the hood, so it is intended for Unix-like environments (Linux/macOS). It is not supported on native Windows shells.

### 🔸 Clean + Rebuild Frontend (Optional)

[](#-clean--rebuild-frontend-optional)

Use the `--build` flag to also run your frontend build steps (`npm install && npm run build` or equivalent):

```
php artisan trash:clean-assets --build
```

This is ideal for resetting the build process after switching branches, clearing corrupted caches, or deploying updates.

---

---

⚙️ Configuration
----------------

[](#️-configuration)

Publish the config file (if you haven't already):

```
php artisan vendor:publish --tag=laravel-trash-cleaner
```

This creates `config/laravel-trash-cleaner.php`:

```
return [

    // Enable Laravel scheduler integration for `trash:clean` (see Scheduling below).
    'schedule' => false,

    // How often the scheduled cleanup runs. Must be a valid Laravel Schedule
    // frequency method, e.g. 'daily', 'hourly', 'everyFifteenMinutes', 'weekly'.
    'frequency' => 'daily',

    // Paths removed by `trash:clean-assets` (relative to the project root, glob supported).
    'cleanup_paths' => [
        'storage/framework/views/*',
        'public/build',
        'node_modules/.vite',
    ],

    // Node package manager used by the `--build` flag: "npm", "pnpm", or "yarn".
    'package_manager' => 'npm',

    // Commands run (per entry) when `--build` is passed, prefixed by the package manager above.
    // e.g. with npm: `npm install` then `npm run build`.
    'build_commands' => [
        'install',
        'run build',
    ],
];
```

KeyTypeDefaultDescription`schedule``bool``false`Auto-schedule `trash:clean` via Laravel's scheduler.`frequency``string``'daily'`Any Laravel `Schedule` frequency method name.`cleanup_paths``array`see abovePaths deleted by `trash:clean-assets`.`package_manager``string``'npm'`Node package manager for the `--build` step.`build_commands``array``['install', 'run build']`Commands appended to the package manager when building.> **Tip:** If you use **`pnpm`** instead of the default **`npm`**, set `'package_manager' => 'pnpm'`.

---

⏰ Scheduling Automatic Cleanup
------------------------------

[](#-scheduling-automatic-cleanup)

To automate cleanup using Laravel's scheduler:

1. Enable it in your config:

```
'schedule' => true,
'frequency' => 'daily', // any Laravel Schedule frequency method, e.g. 'hourly', 'weekly'
```

2. Ensure Laravel's scheduler is running via cron:

```
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1
```

> **Note:** Only `trash:clean` (debug files) is auto-scheduled. To schedule `trash:clean-assets` as well, register it manually in your application's `routes/console.php` (or `app/Console/Kernel.php`):
>
> ```
> Schedule::command('trash:clean-assets')->weekly();
> ```

---

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

---

🛡️ Security
-----------

[](#️-security)

If you discover any security vulnerabilities, please contact:

---

📄 License
---------

[](#-license)

Licensed under the [MIT License](LICENSE.md).

---

📚 Helpful Open Source Packages
------------------------------

[](#-helpful-open-source-packages)

- [![lexi translate](https://raw.githubusercontent.com/omaralalwi/lexi-translate/master/public/images/lexi-translate-banner.jpg) Lexi Translate ](https://github.com/omaralalwi/lexi-translate) simplify managing translations for multilingual Eloquent models with power of morph relationships and caching .
- [![laravel Taxify](https://raw.githubusercontent.com/omaralalwi/Gpdf/master/public/images/gpdf-banner-bg.jpg) Gpdf ](https://github.com/omaralalwi/Gpdf) Open Source HTML to PDF converter for PHP &amp; Laravel Applications, supports Arabic content out-of-the-box and other languages..
- [![laravel Taxify](https://raw.githubusercontent.com/omaralalwi/laravel-taxify/master/public/images/taxify.jpg) **laravel Taxify** ](https://github.com/omaralalwi/laravel-taxify) Laravel Taxify provides a set of helper functions and classes to simplify tax (VAT) calculations within Laravel applications.
- [![laravel Deployer](https://raw.githubusercontent.com/omaralalwi/laravel-deployer/master/public/images/deployer.jpg) **laravel Deployer** ](https://github.com/omaralalwi/laravel-deployer) Streamlined Deployment for Laravel and Node.js apps, with Zero-Downtime and various environments and branches.
- [![laravel Trash Cleaner](https://raw.githubusercontent.com/omaralalwi/laravel-time-craft/master/public/images/laravel-time-craft.jpg) **laravel Time Craft** ](https://github.com/omaralalwi/laravel-time-craft)simple trait and helper functions that allow you, Effortlessly manage date and time queries in Laravel apps.
- [![Laravel Startkit](https://raw.githubusercontent.com/omaralalwi/laravel-startkit/master/public/screenshots/backend-rtl.png) **Laravel Startkit** ](https://github.com/omaralalwi/laravel-startkit) Laravel Admin Dashboard, Admin Template with Frontend Template, for scalable Laravel projects.

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance68

Regular maintenance activity

Popularity34

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 96.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 ~96 days

Total

5

Last Release

415d ago

PHP version history (2 changes)1.0.0PHP ^7.4|^8.1|^8.2|^8.3

1.0.3PHP ^7.4|^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/46733da79a34ff686b036a09af1dcc6d21054aee25a5e029500dc87d3c69ba89?d=identicon)[WatheqAlshowaiter](/maintainers/WatheqAlshowaiter)

![](https://www.gravatar.com/avatar/92882431481b621f6509ff259dd600e327c27fc77adcba4fcc7177659059c9a8?d=identicon)[omaralalwi](/maintainers/omaralalwi)

---

Top Contributors

[![omaralalwi](https://avatars.githubusercontent.com/u/25439498?v=4)](https://github.com/omaralalwi "omaralalwi (27 commits)")[![A909M](https://avatars.githubusercontent.com/u/119125167?v=4)](https://github.com/A909M "A909M (1 commits)")

---

Tags

cleanclean-logsclear-debug-filesclear-log-filesclockworkdebug-fileslaravellaravel-cleanlaravel-cleanerlaravel-performancelaravel-speed-uplaravel-trashlogs-filestelescopeschedulerlaraveldebugbarlaravel-packagevitelaravel-toolyarntelescopeprogress barartisan-commandClockworkLaravel Utilitiesclear cacheomaralalwiphp-packagelog filessystem performancelaravel maintenancecache cleanerpnpmlaravel-trash-cleanerDisk SpaceLog Rotationbuild cleanupdebug cleanuplog cleanupstorage cleanupoptimize laravellaravel cleanercleanup commandfrontend buildnpm buildnpm cachepnpm cachefile cleanerautomated cleanupapplication healthenvironment optimization

### Embed Badge

![Health badge](/badges/omaralalwi-laravel-trash-cleaner/health.svg)

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

###  Alternatives

[realrashid/sweet-alert

Laravel Sweet Alert Is A Package For Laravel Provides An Easy Way To Display Alert Messages Using The SweetAlert2 Library.

1.2k3.2M22](/packages/realrashid-sweet-alert)[imanghafoori/laravel-nullable

A package to help you write expressive defensive code in a functional manner

151500.8k6](/packages/imanghafoori-laravel-nullable)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2228.6k](/packages/guanguans-laravel-soar)[classiebit/eventmie

Run your own Events business with Eventmie Pro. Use it as event ticket selling website or event management platform on your own domain.

1892.0k](/packages/classiebit-eventmie)[paxha/laravel-reportable

This Laravel Eloquent extension provides record according to dates using models.

121.3k](/packages/paxha-laravel-reportable)

PHPackages © 2026

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