PHPackages                             burn/yii2-db-archiver - 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. burn/yii2-db-archiver

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

burn/yii2-db-archiver
=====================

DbArchiver archive and restore old data from DB to file by Yii2 ActiveRecord models. For big tables allow direct file export from MySQL database(fast archiving, but file save only on MySQL server drive)

1.0.2(10y ago)07.1k↓54.8%BSD-4-ClausePHPPHP &gt;=5.4.0

Since Jul 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/burnb/yii2-db-archiver)[ Packagist](https://packagist.org/packages/burn/yii2-db-archiver)[ RSS](/packages/burn-yii2-db-archiver/feed)WikiDiscussions master Synced 2d ago

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

Yii2 DB Archiver.
=================

[](#yii2-db-archiver)

What is this?
-------------

[](#what-is-this)

DbArchiver archive and restore old data from db to file by Yii2 ActiveRecord models. For big tables allow direct file export from MySQL database(fast archiving, but file save only on MySQL server drive).

---

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

[](#installation)

Yii2 framework and PHP 5.4 or higher is required to use it.

Installation is recommended to be done via \[composer\]\[\] by adding the following to the `require` section in your `composer.json`:

```
"burn/yii2-db-archiver": "dev-master"
```

Run `composer update` afterwards.

Usage:
------

[](#usage)

At first set in main app config dbArchiver component like this:

```
    'components' => [
            'dbArchiver' => [
                'class'    => 'burn\dbArchiver\DbArchiver',
                'dumpPath' => '/home/'
            ]
        ],

```

Example console action, using DbArchiver component for large table with direct archiving and date column in Unix timestamp format:

```
  /**
   * @throws \yii\base\InvalidConfigException
   */
  public function actionArchiveErrorsLog()
  {
      /** @var \burn\dbArchiver\DbArchiver $dbArchiver */
      $dbArchiver = \Yii::$app->get('dbArchiver');
      $dbArchiver
          ->getQuery()
          ->setArchivedModel(LogError::className())
          ->setDirect(true)
          ->setDateColumn('log_time')
          ->setMkTimeDateColumn(true);
      if (!$dbArchiver->actionArchive()) {
          \Yii::error(LogError::tableName() . ' table not archived!');
          echo 'Something went wrong! '. LogError::tableName() . ' table not archived!';
      }
  }

```

Example of restore console action:

```
    /**
    * @throws \yii\base\InvalidConfigException
    */
    public function actionRestoreErrorsLog($filename)
    {
        /** @var \burn\dbArchiver\DbArchiver $dbArchiver */
        $dbArchiver = \Yii::$app->get('dbArchiver');
        $dbArchiver
            ->getQuery()
            ->setArchivedModel(LogError::className())
            ->setDirect(true);
        if (!$dbArchiver->actionRestoreFromFile($filename)) {
            \Yii::error(LogError::tableName() . ' table not restored!');
            echo 'Something went wrong! '. LogError::tableName() . ' table not restored!';
        }
    }

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~5 days

Total

3

Last Release

4006d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/544a6b7dd9fbb2974e70435b9a7e1d47635ee509b9542d7ddaf9d0e044a43d35?d=identicon)[burnb](/maintainers/burnb)

---

Top Contributors

[![burnb](https://avatars.githubusercontent.com/u/5370603?v=4)](https://github.com/burnb "burnb (9 commits)")

---

Tags

dumparchivemysqldbyii2extensionarchiver

### Embed Badge

![Health badge](/badges/burn-yii2-db-archiver/health.svg)

```
[![Health](https://phpackages.com/badges/burn-yii2-db-archiver/health.svg)](https://phpackages.com/packages/burn-yii2-db-archiver)
```

###  Alternatives

[sjaakp/yii2-spatial

Yii2 ActiveRecord supporting MySQL spatial data

1878.8k1](/packages/sjaakp-yii2-spatial)[dmstr/yii2-db

Database extensions

19656.2k6](/packages/dmstr-yii2-db)[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

62414.3k11](/packages/rah-danpu)[mg-code/yii2-helpers

A collection of useful helper classes for Yii framework 2.0

2023.3k5](/packages/mg-code-yii2-helpers)

PHPackages © 2026

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