PHPackages                             clntdev/scrubber - 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. clntdev/scrubber

ActiveLibrary

clntdev/scrubber
================

A PHP package for scrubbing data from defined fields in a database

2.0.0(2y ago)21371[1 issues](https://github.com/clnt/scrubber/issues)[1 PRs](https://github.com/clnt/scrubber/pulls)1MITPHPPHP &gt;=8.0

Since Nov 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/clnt/scrubber)[ Packagist](https://packagist.org/packages/clntdev/scrubber)[ RSS](/packages/clntdev-scrubber/feed)WikiDiscussions production Synced 1mo ago

READMEChangelogDependencies (6)Versions (4)Used By (1)

Scrubber
========

[](#scrubber)

[![Stable Build](https://camo.githubusercontent.com/87d2f0532df8b9f8025dcad5ca62361924fb7b51a18db501fa28bd0c255a0c01/68747470733a2f2f706f7365722e707567782e6f72672f636c6e746465762f73637275626265722f76657273696f6e)](https://packagist.org/packages/clntdev/scrubber)[![CI Status](https://github.com/clnt/scrubber/actions/workflows/.github-actions.yml/badge.svg)](https://github.com/clnt/scrubber/actions)[![](https://camo.githubusercontent.com/1f91f40cae545c7b4d216dab3a24f5a82046dde405cbdb67f897e4b55fee73a1/68747470733a2f2f636f6465636f762e696f2f67682f636c6e742f73637275626265722f6272616e63682f70726f64756374696f6e2f67726170682f62616467652e7376673f746f6b656e3d5332564f305148435038)](https://codecov.io/gh/clnt/scrubber)

Scrubber is a minimal PHP package with only one dependency, it allows you to define a PHP configuration file which can help update database fields with various predefined or random values. This is perfect for when you need a copy of a production database to work on and need to erase sensitive content.

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

[](#installation)

Install via composer by running: `composer require clntdev/scrubber`

Usage
-----

[](#usage)

### Configuration File

[](#configuration-file)

The package relies on a valid PHP configuration file to function correctly, this file returns a simple array which maps out the tables, fields and their details so it knows which handler to use.

A handler is detected from the `value` given for a field.

- A field can have a `primary_key` defined on it if you want to use an alternative column to fetch database records, the default is `id`.
- A field can have a `handler` defined on it if you wish to override the detected handler.
- A field can have a `type` defined on it which can be used to define the field as a certain data type such as `pid` for GDPR purposes (this is useful in the methods listed further down)

Here is an example configuration used in the unit tests:

```
