PHPackages                             cornernote/yii2-softdelete - 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. cornernote/yii2-softdelete

ActiveYii2-behavior[Utility &amp; Helpers](/categories/utility)

cornernote/yii2-softdelete
==========================

Soft delete behavior for Yii2.

1.0.3(8y ago)2315.3kBSD-3-Clause

Since Jun 20Compare

[ Source](https://github.com/cornernote/yii2-softdelete)[ Packagist](https://packagist.org/packages/cornernote/yii2-softdelete)[ RSS](/packages/cornernote-yii2-softdelete/feed)WikiDiscussions Synced today

READMEChangelog (2)Dependencies (4)Versions (5)Used By (0)

Yii2 Soft Delete
================

[](#yii2-soft-delete)

[![Latest Version](https://camo.githubusercontent.com/a470f463123a2fa30f82d5ad558e7d37d3cd18c163a4103bd2138b20a8b47feb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f636f726e65726e6f74652f796969322d736f667464656c6574652e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/cornernote/yii2-softdelete/tags)[![Software License](https://camo.githubusercontent.com/b60331a2084501dc07cf6d6964c0da58dd005d89c45cf3b28b4b22b60f5ec00f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/adc9907ab7f36a47b9e171472c070db5f0d96915ea10d232a276984d30e872ec/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f726e65726e6f74652f796969322d736f667464656c6574652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/cornernote/yii2-softdelete)[![Coverage Status](https://camo.githubusercontent.com/e30dcc1d9efb7f447b12e3a958e9a77b2152e6265c6f48e21b46811cf9928a05/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f636f726e65726e6f74652f796969322d736f667464656c6574652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cornernote/yii2-softdelete/code-structure)[![Quality Score](https://camo.githubusercontent.com/66fa17bee8f5fc774c1fdc9d2db487485faf292c450b4853979c027b9f388027/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f726e65726e6f74652f796969322d736f667464656c6574652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/cornernote/yii2-softdelete)[![Total Downloads](https://camo.githubusercontent.com/87966d3b9098d384e73209d20528af6a1fbaa7273ea8d6ad8c9b89ecb1ab16da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f726e65726e6f74652f796969322d736f667464656c6574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cornernote/yii2-softdelete)

Soft delete behavior for Yii2.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require cornernote/yii2-softdelete "*"

```

or add

```
"cornernote/yii2-softdelete": "*"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

In your ActiveRecord class:

```
public function behaviors() {
    return [
        \cornernote\softdelete\SoftDeleteBehavior::className(),
        // or
        [
            'class' => \cornernote\softdelete\SoftDeleteBehavior::className(),
            'attribute' => 'deleted_time',
            'value' => new \yii\db\Expression('NOW()'), // for sqlite use - new \yii\db\Expression("date('now')")
        ],
    ];
}
```

then you can use explicitly `$model->softDelete()`, `$model->hardDelete()`and `$model->unDelete()` (for softly deleted models). Each of these methods return boolean result. Also `$model->softDelete()` calls indirectly from `$model->delete()`, which always returns `false`.

In your ActiveQuery class:

```
public function behaviors() {
    return [
        \cornernote\softdelete\SoftDeleteQueryBehavior::className(),
        // or
        [
            'class' => \cornernote\softdelete\SoftDeleteQueryBehavior::className(),
            'attribute' => 'deleted_time',
        ],
    ];
}
```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 93.9% 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 ~272 days

Total

4

Last Release

3214d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07c84a589344489e8195ec1c6afcfa3abcc23a73092ceaa4ca60da96355c4d16?d=identicon)[cornernote](/maintainers/cornernote)

---

Top Contributors

[![cornernote](https://avatars.githubusercontent.com/u/51875?v=4)](https://github.com/cornernote "cornernote (46 commits)")[![AntonTyutin](https://avatars.githubusercontent.com/u/548575?v=4)](https://github.com/AntonTyutin "AntonTyutin (1 commits)")[![davidjeddy](https://avatars.githubusercontent.com/u/6232455?v=4)](https://github.com/davidjeddy "davidjeddy (1 commits)")[![elvenpath](https://avatars.githubusercontent.com/u/1319068?v=4)](https://github.com/elvenpath "elvenpath (1 commits)")

---

Tags

yii2soft-delete

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cornernote-yii2-softdelete/health.svg)

```
[![Health](https://phpackages.com/badges/cornernote-yii2-softdelete/health.svg)](https://phpackages.com/packages/cornernote-yii2-softdelete)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[imanilchaudhari/yii2-currency-converter

This extension will help to find out current currency conversion rate.

2111.7k](/packages/imanilchaudhari-yii2-currency-converter)

PHPackages © 2026

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