PHPackages                             sarelvdwalt/db-archive-bundle - 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. sarelvdwalt/db-archive-bundle

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

sarelvdwalt/db-archive-bundle
=============================

Bundle to archive database tables using different strategies

2121PHP

Since Oct 17Pushed 10y ago2 watchersCompare

[ Source](https://github.com/sarelvdwalt/SFDatabaseArchiveBundle)[ Packagist](https://packagist.org/packages/sarelvdwalt/db-archive-bundle)[ RSS](/packages/sarelvdwalt-db-archive-bundle/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (3)Used By (0)

SFArchiveBundle
===============

[](#sfarchivebundle)

Purpose
-------

[](#purpose)

The purpose of this bundle is to provide a generic Symfony2 Console Command which is used to archive DB tables. The general idea is that you give it a table name, and a strategy that it should follow to archive.

Say you have 100 000 000 records in a table called "**stuff**". Let's assume for a second that the table called "**stuff**" has a **created\_at** field attached to it, which is a date-time field in MySQL (or whatever your underlying database is).

When calling the command `php app/console archive:generic stuff` it will run through the table **stuff** and archive the values into tables starting with a "z" and ending in the "Ym" value corresponding to the record's **created\_at** column.

As an example, a record having **created\_at** of "2014-03-11 23:54:22" will be archived to the table with name zstuff201403. And record having **created\_at** of "2014-02-28 08:23:00" will go to zstuff201402 - notice the difference is in the month at the end.

The rational behind this is that tables starting with z will be at the end of your list of tables, in an effort to avoid cluttering your main view of your database.

Usage
-----

[](#usage)

```
Usage:
 archive:generic [--days="..."] [--strategy-z-tables[="..."]] [--strategy-source-field="..."] [--batch-size[="..."]]
 [--source-entity-manager="..."] [--destination-entity-manager="..."] table_name

Arguments:
 table_name                    The name of the source table to archive

Options:
 --days                        Defines how many days in the past to start archive.
                               Example, 14 would archive data older than 14 days (default: 90)
 --strategy-z-tables           Strategy is to create tables of the same name, in format zTableNameYm
                               (ex zclients201403. (default: "Ym")
 --strategy-source-field       Field to base the strategy on. For the YYYYMM strategy, this has to be
                               a date field (default: "created_at")
 --batch-size                  Size of each batch. It is important not to choose too big or small a batch.
                               Big batches will cause memory problems, small ones will decrease the
                               speed of archiving. (default: 100)
 --source-entity-manager       Source Entity Manager to archive from (default: "default")
 --destination-entity-manager  Destination Entity Manager to archive to. If none is provided,
                               the same as --source-entity-manager will be used. (default: "default">

```

Reporting an issue or a feature request
---------------------------------------

[](#reporting-an-issue-or-a-feature-request)

Please submit issues and feature requests in the [Github issue tracker](https://github.com/sarelvdwalt/SFDatabseArchiveBundle/issues).

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.3% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2071493?v=4)[Sarel van der Walt](/maintainers/sarelvdwalt)[@sarelvdwalt](https://github.com/sarelvdwalt)

---

Top Contributors

[![sarelvdwalt](https://avatars.githubusercontent.com/u/2071493?v=4)](https://github.com/sarelvdwalt "sarelvdwalt (26 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

### Embed Badge

![Health badge](/badges/sarelvdwalt-db-archive-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/sarelvdwalt-db-archive-bundle/health.svg)](https://phpackages.com/packages/sarelvdwalt-db-archive-bundle)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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