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

ActiveLibrary

clntdev/scrubber-laravel
========================

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

1.0.5(1y ago)4341MITPHPPHP ^8.1CI passing

Since Nov 25Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (12)Versions (9)Used By (0)

Scrubber (Laravel Wrapper)
==========================

[](#scrubber-laravel-wrapper)

[![Stable Build](https://camo.githubusercontent.com/4728b8d332ac0e2e1116e3cde54fc56f7a233ac126666020b21b9e2be6a4277f/68747470733a2f2f706f7365722e707567782e6f72672f636c6e746465762f73637275626265722d6c61726176656c2f76657273696f6e)](https://packagist.org/packages/clntdev/scrubber-laravel)[![CI Status](https://github.com/clnt/scrubber-laravel/actions/workflows/.github-actions.yml/badge.svg)](https://github.com/clnt/scrubber-laravel/actions)[![](https://camo.githubusercontent.com/c29d71cb8828a5f17c580c202e6563238125a5263b91b8915382b70308a4ca25/68747470733a2f2f636f6465636f762e696f2f67682f636c6e742f73637275626265722d6c61726176656c2f6272616e63682f70726f64756374696f6e2f67726170682f62616467652e7376673f746f6b656e3d4c5a3353494f3436434e)](https://codecov.io/gh/clnt/scrubber-laravel)

Scrubber (Laravel Wrapper) is a simple Laravel wrapper that adds in a Facade and some useful artisan commands around a minimal PHP package called [Scrubber](https://github.com/clnt/scrubber), this 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-laravel`

Publish the package configuration to `config/scrubber.php` by running: `php artisan vendor:publish --tag=scrubber`

Usage
-----

[](#usage)

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.

If using the default location, create a `scrubber.php` file at the root of your Laravel project. If using an alternative then set the absolute path in the `config/scrubber.php` file.

- 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:

```
