PHPackages                             edisonlabs/database\_sanitize - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. edisonlabs/database\_sanitize

ActiveDrupal-module[Validation &amp; Sanitization](/categories/validation)

edisonlabs/database\_sanitize
=============================

Provides drush commands for yaml sanitization files checks and generation.

3060557.x-dev(7y ago)51.7M↑53.8%6[4 PRs](https://github.com/EdisonLabs/database_sanitize/pulls)GPL-2.0+PHP

Since Jun 10Pushed 4mo ago6 watchersCompare

[ Source](https://github.com/EdisonLabs/database_sanitize)[ Packagist](https://packagist.org/packages/edisonlabs/database_sanitize)[ RSS](/packages/edisonlabs-database-sanitize/feed)WikiDiscussions 8.x-1.x Synced 3w ago

READMEChangelogDependencies (2)Versions (13)Used By (0)

[![Build Status](https://camo.githubusercontent.com/a96f6c02bb9d553221c8d2783825a25881e202bbe9b66d9bc688d497042fa714/68747470733a2f2f7472617669732d63692e636f6d2f456469736f6e4c6162732f64617461626173655f73616e6974697a652e7376673f6272616e63683d382e782d312e78)](https://travis-ci.com/EdisonLabs/database_sanitize)

Database Sanitize
=================

[](#database-sanitize)

Overview
--------

[](#overview)

Provides a set of drush commands to assist in generating a `database.sanitize.yml` file containing all the queries for database sanitization.

### Commands included

[](#commands-included)

- `db-sanitize-analyze (dbsa)` Compares existing `database.sanitize.yml` files on the site installation against existing database tables and list tables that needs to be verified and possibly sanitized.
- `db-sanitize-generate (dbsg)` generates a `database.sanitize.yml` file for all tables not specified in `database.sanitize.yml` files.

Use the option `--file` to specify a YML file and skip the scan. This is meant to be used alongside [merge-yaml](https://github.com/EdisonLabs/merge-yaml) composer plugin, so that when you build your local environment for a drupal site, an `database.sanitize.merge.yml` file will be generated. This file's path is what you're expected to pass in.

Usage instructions
------------------

[](#usage-instructions)

You can provide a `database.sanitize.yml` file containing queries for database sanitization for your module or profile.

**File format**

```
sanitize:
    MACHINE_NAME:
        DBTABLENAME1:
            description: 'query description'
            query: 'DB QUERY 1'
        DBTABLENAME2:
            description: 'query description'
            query: 'DB QUERY 2'
    MACHINE_NAME2:
        DBTABLENAME3:
            description: 'query description'
            query: 'DB QUERY 3'
        DBTABLENAME4: false
        DBTABLENAMEPREFIX*: false

```

Using a wildcard `*` for table names is supported. For example, setting `node_revision*` will apply to all tables names starting with `node_revision`.

### Commands usage

[](#commands-usage)

To find out how many tables needs to be defined in `database.sanitize.yml` files:

```
drush dbsa

```

```
# Specifying a file.
drush dbsa --file=/var/www/SITE/NON-PUBLIC-FOLDER/database.sanitize.merge.yml

```

To get the YAML file content for the missing tables to be sanitized:

```
drush dbsg --machine-name="my_module"

```

To save the missing tables to a `database.sanitize.yml` file:

```
drush dbsg --machine-name="MY_profile" > docroot/profiles/MY_profile/database.sanitize.yml

```

The generated queries for each missing table default to `TRUNCATE TABLE $table`. Developers are expected to assess what content should be sanitized for each table and edit the file accordingly.

Automated Tests and Code Sniffer
--------------------------------

[](#automated-tests-and-code-sniffer)

This repository is integrated with [Travis CI](https://travis-ci.com/EdisonLabs/database_sanitize) to perform tests and detect Drupal coding standards violations.

Running tests locally for development
-------------------------------------

[](#running-tests-locally-for-development)

You will need to:

1. Run composer install.
2. Run composer install inside the `vendor/drush/drush` directory.
3. Within the root of the package, run this command adjusting `UNISH_DB_URL` with your database configuration.

```
UNISH_DB_URL="mysql://USERNAME:PASSWORD@127.0.0.1" UNISH_NO_TIMEOUTS=y vendor/drush/drush/vendor/bin/phpunit --configuration "vendor/drush/drush/tests" drush/tests/

```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance51

Moderate activity, may be stable

Popularity46

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.6% 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 ~620 days

Total

4

Last Release

739d ago

Major Versions

3.x-dev → 4.x-dev2024-07-15

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1932061?v=4)[Jean Ribeiro](/maintainers/jkribeiro)[@jkribeiro](https://github.com/jkribeiro)

---

Top Contributors

[![manuee](https://avatars.githubusercontent.com/u/105582?v=4)](https://github.com/manuee "manuee (10 commits)")[![jkribeiro](https://avatars.githubusercontent.com/u/1932061?v=4)](https://github.com/jkribeiro "jkribeiro (7 commits)")[![kmoll](https://avatars.githubusercontent.com/u/4575507?v=4)](https://github.com/kmoll "kmoll (1 commits)")[![manuel-work](https://avatars.githubusercontent.com/u/9803336?v=4)](https://github.com/manuel-work "manuel-work (1 commits)")

### Embed Badge

![Health badge](/badges/edisonlabs-database-sanitize/health.svg)

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

###  Alternatives

[hybridlogic/validation

A simple, extensible validation library for PHP with support for filtering and validating any input array along with generating client side validation code.

641.1k](/packages/hybridlogic-validation)

PHPackages © 2026

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