PHPackages                             sentinelphp/redact - 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. sentinelphp/redact

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

sentinelphp/redact
==================

PII redaction library for JSON payloads and strings

v1.0.1(2mo ago)001GPL-3.0-or-laterPHP &gt;=8.2

Since Apr 27Compare

[ Source](https://github.com/SentinelPHP/Redact)[ Packagist](https://packagist.org/packages/sentinelphp/redact)[ Docs](https://github.com/SentinelPHP/redact)[ RSS](/packages/sentinelphp-redact/feed)WikiDiscussions Synced 3w ago

READMEChangelogDependencies (2)Versions (3)Used By (1)

Sentinel Redact
===============

[](#sentinel-redact)

[![Latest Version](https://camo.githubusercontent.com/e4f627b3da9cdae07d83f0f9e874f6481e1f469fd9033dc6374767bbc0ec80fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73656e74696e656c7068702f7265646163742e737667)](https://packagist.org/packages/sentinelphp/redact)[![License](https://camo.githubusercontent.com/8b7127e3390e18940479372b845f6110ba46859d4c69e530e01dc51a4f5b80d3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f73656e74696e656c7068702f7265646163742e737667)](https://github.com/SentinelPHP/redact/blob/main/LICENSE)

PII redaction library for JSON payloads and strings.

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

[](#installation)

```
composer require sentinelphp/redact
```

Usage
-----

[](#usage)

```
use SentinelPHP\Redact\PiiRedactor;

$redactor = new PiiRedactor();

// Redact PII from a string
$text = "Contact me at john@example.com or 555-123-4567";
$redacted = $redactor->redactString($text);
// Result: "Contact me at [EMAIL REDACTED] or [PHONE REDACTED]"

// Redact PII from JSON data
$data = [
    'user' => [
        'email' => 'john@example.com',
        'phone' => '555-123-4567',
        'credit_card' => '4111-1111-1111-1111',
    ],
];
$redacted = $redactor->redact($data);
```

Built-in Patterns
-----------------

[](#built-in-patterns)

- **Credit Cards**: Visa, Mastercard, Amex, Discover
- **Email Addresses**: Standard email format
- **Phone Numbers**: US phone formats
- **SSN**: US Social Security Numbers
- **API Keys**: Common API key formats (Stripe, Bearer tokens)

Custom Patterns
---------------

[](#custom-patterns)

```
$redactor = new PiiRedactor();

// Add a custom pattern
$redactor->addPattern('custom_id', '/ID-\d{6}/', '[ID REDACTED]');

// Remove a default pattern
$redactor->removePattern('phone');
```

Field Path Redaction
--------------------

[](#field-path-redaction)

Redact specific fields by their JSON path:

```
$redactor = new PiiRedactor();
$redactor->addFieldPath('user.password');
$redactor->addFieldPath('*.secret');

$data = ['user' => ['password' => 'secret123']];
$redacted = $redactor->redact($data);
// Result: ['user' => ['password' => '[REDACTED]']]
```

License
-------

[](#license)

GPL v3 — see LICENSE for details

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance83

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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 ~0 days

Total

2

Last Release

88d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3542330?v=4)[Tommy Lynge Jørgensen](/maintainers/TLyngeJ)[@TLyngeJ](https://github.com/TLyngeJ)

---

Tags

redactiongdprprivacydata protectionpii

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sentinelphp-redact/health.svg)

```
[![Health](https://phpackages.com/badges/sentinelphp-redact/health.svg)](https://phpackages.com/packages/sentinelphp-redact)
```

###  Alternatives

[statikbe/laravel-cookie-consent

Cookie consent modal for EU

219426.2k](/packages/statikbe-laravel-cookie-consent)[opengento/module-gdpr

Gdpr Compliance Module for Magento 2

14586.0k](/packages/opengento-module-gdpr)[georgringer/gdpr

Make TYPO3 more compatible to GDPR

4557.7k](/packages/georgringer-gdpr)[flarum/gdpr

Features for GDPR, PII management

1338.8k22](/packages/flarum-gdpr)

PHPackages © 2026

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