PHPackages                             yii2tech/ar-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. [Database &amp; ORM](/categories/database)
4. /
5. yii2tech/ar-softdelete

AbandonedArchivedYii2-extension[Database &amp; ORM](/categories/database)

yii2tech/ar-softdelete
======================

Provides support for ActiveRecord soft delete in Yii2

1.0.4(6y ago)2073.0M↓17.8%5020BSD-3-ClausePHP

Since Dec 26Pushed 6y ago16 watchersCompare

[ Source](https://github.com/yii2tech/ar-softdelete)[ Packagist](https://packagist.org/packages/yii2tech/ar-softdelete)[ RSS](/packages/yii2tech-ar-softdelete/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (7)Used By (20)

 [ ![](https://avatars2.githubusercontent.com/u/12951949) ](https://github.com/yii2tech)

ActiveRecord Soft Delete Extension for Yii2
===========================================

[](#activerecord-soft-delete-extension-for-yii2)

This extension provides support for ActiveRecord soft delete.

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/bf39db388a60ba7c81be053d9ea3bc7b94db83c057fd82a584c7bee905cf1aed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79696932746563682f61722d736f667464656c6574652e737667)](https://packagist.org/packages/yii2tech/ar-softdelete)[![Total Downloads](https://camo.githubusercontent.com/40d85f9083dad00c0ac2537bd46c2b111dcb1942f6557ca23b9aa144caab6da2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79696932746563682f61722d736f667464656c6574652e737667)](https://packagist.org/packages/yii2tech/ar-softdelete)[![Build Status](https://camo.githubusercontent.com/64a825c8ae90a53af46a6a206581f4289c066b3c747c0f5632efa59e02484035/68747470733a2f2f7472617669732d63692e6f72672f79696932746563682f61722d736f667464656c6574652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yii2tech/ar-softdelete)

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist yii2tech/ar-softdelete

```

or add

```
"yii2tech/ar-softdelete": "*"
```

to the require section of your composer.json.

Usage
-----

[](#usage)

This extension provides support for so called "soft" deletion of the ActiveRecord, which means record is not deleted from database, but marked with some flag or status, which indicates it is no longer active, instead.

This extension provides \[\[\\yii2tech\\ar\\softdelete\\SoftDeleteBehavior\]\] ActiveRecord behavior for such solution support in Yii2. You may attach it to your model class in the following way:

```
