PHPackages                             falconsw/soft-delete-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. [Database &amp; ORM](/categories/database)
4. /
5. falconsw/soft-delete-cleaner

ActiveLibrary[Database &amp; ORM](/categories/database)

falconsw/soft-delete-cleaner
============================

Clean soft deleted records from database

1.0.0(3y ago)06MITPHPPHP &gt;=7.3

Since Jan 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/falconsw/soft-delete-cleaner)[ Packagist](https://packagist.org/packages/falconsw/soft-delete-cleaner)[ RSS](/packages/falconsw-soft-delete-cleaner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

Laravel Soft Delete Cleaner
===========================

[](#laravel-soft-delete-cleaner)

[![GitHub release](https://camo.githubusercontent.com/0bb5aa1b235b9179eb7b3d01cb1e664bdff99babce6f15e4000d9aa1d3808c9e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f66616c636f6e73772f736f66742d64656c6574652d636c65616e65722e7376673f696e636c7564655f70726572656c6561736573267374796c653d666f722d7468652d62616467652626636f6c6f72423d374535374332)](https://packagist.org/packages/falconsw/soft-delete-cleaner)[![GitHub issues](https://camo.githubusercontent.com/fdbb98b6bcce5091dab979b7ced630761cd501c9e9e25eb0906bc64015fcb89e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f66616c636f6e73772f736f66742d64656c6574652d636c65616e65722e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/falconsw/soft-delete-cleaner/issues)[![Software License](https://camo.githubusercontent.com/c003d4d48be8c870b7f5dfef6e898cc00ece72e12064c1eb199611b0e290ce92/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666f722d7468652d62616467652626636f6c6f72423d463237453430)](license.md)[![Total Downloads](https://camo.githubusercontent.com/48be4edea0ca013a712332a041313437bff76b52be23c926359b7f8c1e0fbaba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66616c636f6e73772f736f66742d64656c6574652d636c65616e65722e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/falconsw/soft-delete-cleaner)

This package deletes soft deleted rows automatically after a time interval that you define.

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

[](#installation)

### Step 1

[](#step-1)

Require the package with composer using the following command:

```
composer require falconsw/soft-delete-cleaner
```

### Step 2

[](#step-2)

The service provider will automatically get registered. Or you may manually add the service provider in your `config/app.php` file:

```
'providers' => [
    // ...
    \FalconSW\SoftDeleteCleaner\SoftDeleteCleanerServiceProvider::class,
];
```

### Step 3

[](#step-3)

Now its the time for scheduling the command. in you `app/Console/Kernel.php` file, paste this code in `schedule()` function:

```
protected function schedule(Schedule $schedule)
{
    // ...
    $schedule->command(\FalconSW\SoftDeleteCleaner\SoftDeleteCleanerCommand::class)->hourly();
    // ...
}
```

In the code above, the command scheduled to run hourly. you can change it. For more information, please read [this](https://laravel.com/docs/scheduling#scheduling-artisan-commands) page.

### Step 4 (Optional)

[](#step-4-optional)

You can publish the config file with this following command:

```
php artisan vendor:publish --provider="FalconSW\SoftDeleteCleaner\SoftDeleteCleanerServiceProvider" --tag=config
```

Also you can set the `SOFT_DELETE_CLEANER_EXPIRE_TIME` value in `.env` file. like the following code:

```
...
SOFT_DELETE_CLEANER_EXPIRE_TIME='1 day'
...
```

Usage
-----

[](#usage)

in your models that used `SoftDeletes` trait, you can enable Soft Delete Cleaner with this code:

```
class SampleModel extends Model
{
    use SoftDeletes;
    const SOFT_DELETE_CLEANER_STATUS = true;
}
```

Just write `const SOFT_DELETE_CLEANER_STATUS = true` in your models! Also you can set expiration time for your deleted entities using the following line:

```
const SOFT_DELETE_CLEANER_EXPIRE_TIME = '5 months';
```

In the code above, expiration time for your soft deleted entity model is 5 months. The final code is:

```
class SampleModel extends Model
{
    use SoftDeletes;
    const SOFT_DELETE_CLEANER_STATUS = true;
    const SOFT_DELETE_CLEANER_EXPIRE_TIME = '5 months';
}
```

You can set any other values for `SOFT_DELETE_CLEANER_EXPIRE_TIME` like `5`(means 5 days), `2 hours`, `45 days`, `2.5 months`, `1 year`, etc.

**Note:** If you don't set any value for `SOFT_DELETE_CLEANER_EXPIRE_TIME` in your model, the soft deleted models with `SOFT_DELETE_CLEANER_STATUS = true` will be hard deleted after the time defined in config file named `auto-hard-deleter.php`.

Soft Delete Cleaner Command
---------------------------

[](#soft-delete-cleaner-command)

Also you can hard delete expired rows manually using this artisan command:

```
php artisan soft-delete:clean
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1224d ago

### Community

Maintainers

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

---

Top Contributors

[![falconsw](https://avatars.githubusercontent.com/u/6252528?v=4)](https://github.com/falconsw "falconsw (1 commits)")

---

Tags

laraveldatabaselumensoftdelete

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/falconsw-soft-delete-cleaner/health.svg)

```
[![Health](https://phpackages.com/badges/falconsw-soft-delete-cleaner/health.svg)](https://phpackages.com/packages/falconsw-soft-delete-cleaner)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)[dragon-code/laravel-data-dumper

Adding data from certain tables when executing the `php artisan schema:dump` console command

3418.6k](/packages/dragon-code-laravel-data-dumper)

PHPackages © 2026

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