PHPackages                             tobymaxham/array-faker-redactor - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tobymaxham/array-faker-redactor

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tobymaxham/array-faker-redactor
===============================

A PHP package to redact or fake array values by their keys.

v1.0(6y ago)419MITPHP

Since Jul 14Pushed 6y agoCompare

[ Source](https://github.com/TobyMaxham/array-faker-redactor)[ Packagist](https://packagist.org/packages/tobymaxham/array-faker-redactor)[ RSS](/packages/tobymaxham-array-faker-redactor/feed)WikiDiscussions master Synced 2d ago

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

TobyMaxham Array Faker Redactor
===============================

[](#tobymaxham-array-faker-redactor)

A PHP package to redact or fake array values by their keys no matter how deep the array.

[![Latest Version on Packagist](https://camo.githubusercontent.com/6ea6f0c1627df0ca013283a48bcc9d0e21dae957fdc079d79e9b047ca25b120a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f62796d617868616d2f61727261792d66616b65722d7265646163746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tobymaxham/array-faker-redactor)[![GitHub commits](https://camo.githubusercontent.com/1248a25b3fe6cc6a97de091b0842f83a9ce0ab4b583bbba7d4cf4d65856b6ed8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6d6d6974732d73696e63652f746f62796d617868616d2f61727261792d66616b65722d7265646163746f722f76312e302e737667)](https://GitHub.com/tobymaxham/array-faker-redactor/commit/)[![Total Downloads](https://camo.githubusercontent.com/745e0439a4177f39bd0727fbc9e0e37d358093da9878fd6053da6ef0e6de33b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f62796d617868616d2f61727261792d66616b65722d7265646163746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tobymaxham/array-faker-redactor)[![GitHub contributors](https://camo.githubusercontent.com/ee968032eeea804f69a1b03e200ed6d0df690c32c0631de309a0ec35f1406a41/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636f6e7472696275746f72732f746f62796d617868616d2f61727261792d66616b65722d7265646163746f722e737667)](https://GitHub.com/TobyMaxham/array-faker-redactor/graphs/contributors/)[![GitHub issues](https://camo.githubusercontent.com/ac3bece377156f5fcbb802ddb29f30d173437bf57e1d07141aee3ebc20ff7ffa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f746f62796d617868616d2f61727261792d66616b65722d7265646163746f722e737667)](https://GitHub.com/TobyMaxham/array-faker-redactor/issues/)

Notice
------

[](#notice)

This packages uses the `mtownsend/array-redactor` package by [mtownsend5512](https://github.com/mtownsend5512) and the `Faker` library by [fzaninotto](https://github.com/fzaninotto). So for more details to those packages look at the repositories readme files:

- [mtownsend/array-redactor](https://github.com/mtownsend5512/array-redactor)
- [fzaninotto/faker](https://github.com/fzaninotto/Faker)

Why
---

[](#why)

Sometimes you need to customized your data to protect the privacy of your users or the security of your application. This is no longer a problem with this package.

With this package, an element of an array or a JSON, no matter how deep, can be easily deleted, redact or faked. This allows you to customize the response of your server or api and pass it on without worry.

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

[](#installation)

Install via composer:

```
composer require tobymaxham/array-faker-redactor

```

Quick start
-----------

[](#quick-start)

### Using the class

[](#using-the-class)

```
use TobyMaxham\ArrayFakerRedactor\ArrayFakerRedactor;

// An example array, maybe a request being made to/from an API application
$content = [
    'email'       => 'git2019@maxham.de',
    'phone'       => '1234567',
    'password'    => 'secret123',
    'notes'       => 'this can be removed',
    'sample_data' => 'nothing else matters',
];

$redactor = (new ArrayFakerRedactor())->content($content)->keys(['email', 'password', 'notes', 'sample_data' => 'random'])->withFaker()->redact();

// $redactor will return something like:
[
    'email'       => 'russel94@hotmail.com',
    'phone'       => '1234567',
    'password'    => ']61i8~}DJB',
    'notes'       => '[REDACTED]',
    'sample_data' => 'e2k9aDUoeXRFQzhP',
];
```

### Advanced usage

[](#advanced-usage)

You can also add your own FakerProvider (see [Faker Docs](https://github.com/fzaninotto/Faker#faker-internals-understanding-providers)).

```
$content = [
    'key' => 'some data',
];

$redactor = (new ArrayFakerRedactor())->content($content)->keys(['key' => 'myformatter'])
    ->withFaker()
    ->addFakerProvider(MyProvider::class)
    ->redact();
```

Testing
-------

[](#testing)

You can run the tests with:

```
./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- TobyMaxham

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

2543d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/900ab0a66bf701f3fb99a4db54276b4984cf3cf9b55ccad6df65c034f58be85f?d=identicon)[TobyMaxham](/maintainers/TobyMaxham)

---

Top Contributors

[![TobyMaxham](https://avatars.githubusercontent.com/u/5646469?v=4)](https://github.com/TobyMaxham "TobyMaxham (3 commits)")

---

Tags

laravelarrayfakerRedactorredact

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/tobymaxham-array-faker-redactor/health.svg)

```
[![Health](https://phpackages.com/badges/tobymaxham-array-faker-redactor/health.svg)](https://phpackages.com/packages/tobymaxham-array-faker-redactor)
```

###  Alternatives

[armincms/json

A Laravel Nova field.

25153.6k3](/packages/armincms-json)[xefi/faker-php-laravel

Faker php integration with laravel

2618.0k](/packages/xefi-faker-php-laravel)[iteks/laravel-enum

A comprehensive Laravel package providing enhanced enum functionalities, including attribute handling, select array conversions, and fluent facade interactions for robust enum management in Laravel applications.

2518.6k](/packages/iteks-laravel-enum)[skovachev/fakefactory

A model factory package for Laravel 4 with expressive API for creating custom tailored dummy objects

291.1k](/packages/skovachev-fakefactory)

PHPackages © 2026

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