PHPackages                             acromedia/database-janitor - 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. acromedia/database-janitor

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

acromedia/database-janitor
==========================

Database sanitizer, trimmer and scrubber.

1.1.0(6y ago)01.3kMPL-2.0PHP

Since Dec 11Pushed 5y agoCompare

[ Source](https://github.com/AcroMedia/database-janitor)[ Packagist](https://packagist.org/packages/acromedia/database-janitor)[ RSS](/packages/acromedia-database-janitor/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (6)Versions (6)Used By (0)

Initial development funded by Acro Media Inc.

Database Janitor [![Build Status](https://camo.githubusercontent.com/7e6014b4cc33fdb2ce2ddd26531188d2acecb14bc4d1bf96769ac2766e326e35/68747470733a2f2f7472617669732d63692e6f72672f676d656d7374722f64617461626173652d6a616e69746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/gmemstr/database-janitor)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#database-janitor-)

Highly-configurable database dumper

Initial development funded by Acro Media Inc.

Features
--------

[](#features)

- Drupal configuration support
- Configuration-first
- PHP with minimal dependencies

Usage
-----

[](#usage)

This application can either be used as a CLI app or a library that other applications can build on top of, e.g a drush command or another custom application.

Command Help
------------

[](#command-help)

```
Description:
  Cleans up databases between servers or dev enviornments

Usage:
  database-janitor [options] [--]

Arguments:
  database                   Database to dump

Options:
      --host[=HOST]          Database host, defaults to localhost
  -u, --username[=USERNAME]  Database username
  -p, --password[=PASSWORD]  Database password
  -t, --trim                 Whether or not to exclude data from dump (trimming)
  -d, --drupal=DRUPAL        Path to a Drupal settings file (ignores host, username and password flags)
  -h, --help                 Display this help message
  -q, --quiet                Do not output any message
  -V, --version              Display this application version
      --ansi                 Force ANSI output
      --no-ansi              Disable ANSI output
  -n, --no-interaction       Do not ask any interactive question
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
```

### Testing

[](#testing)

There is a sample Lando config you can use to spin up two separate mysql databases for testing, as well as a sample SQL file containing random data generated by [Mockaroo](https://mockaroo.com/).

```
lando start
lando db-import sampledata.sql --host real_database
```

### Configuration

[](#configuration)

```
sanitize_tables:
  # List of tables and their columns you want sanitized.
  user:
  - mail
trim_tables:
# List of tables to be trimmed (every 4th row kept)
  - trim1
excluded_tables:
# Tables to NOT dump
  - exclude1
scrub_tables:
# Tables to dump sans content.
  - scrub1
keep_data:
# Keep data in these tables by key
  table_name:
    col: col_name
    # Only row with col value of 1
    rows:
      - 1
  table_name_2:
  # Every other row, using mod
    col: other_col_name
    rows: 2

  table_name_3:
  # Every row with a value of 1, 3 or 8.
    col: third_col_name
    rows: 1, 3, 8
```

### CLI

[](#cli)

First you'll want to copy `.janitor.example.yml` to `.janitor.yml`. You can then go in and edit exactly which tables and columns you want sanitized/ignored/cleared.

If not using the .phar, install dependencies with `composer install`.

#### Dumping

[](#dumping)

This will prompt you for the database password, then produce a gzip'd .sql file in the `output/` directory.

```
./janitor.phar --host=localhost:8787 --username=real real | gzip -c > output/real_test.sql.gz
```

#### Trimming

[](#trimming)

Trimming allows much smaller database dumps by reducing the data exported through the use of keeping data, scrubbing tables, and so on.

```
./janitor.phar --host=localhost:8787 --username=real --trim real | gzip -c > output/real_test.sql.gz
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~115 days

Total

3

Last Release

2481d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4402e1e5bf69d45606c4f2ba3a947c9bbc3f231edbcb0921bebf03dc8cbc2ea7?d=identicon)[acromedia](/maintainers/acromedia)

---

Top Contributors

[![gmemstr](https://avatars.githubusercontent.com/u/1878840?v=4)](https://github.com/gmemstr "gmemstr (8 commits)")[![dylf](https://avatars.githubusercontent.com/u/10430358?v=4)](https://github.com/dylf "dylf (2 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/acromedia-database-janitor/health.svg)

```
[![Health](https://phpackages.com/badges/acromedia-database-janitor/health.svg)](https://phpackages.com/packages/acromedia-database-janitor)
```

###  Alternatives

[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[edyan/neuralyzer

Library and CLI for Data anonymization

53147.1k2](/packages/edyan-neuralyzer)[ymirapp/cli

Ymir command-line tool

2619.6k](/packages/ymirapp-cli)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

203.7k](/packages/perplorm-perpl)

PHPackages © 2026

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