PHPackages                             promptphp/intercept-pii-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. [Security](/categories/security)
4. /
5. promptphp/intercept-pii-redactor

ActiveLibrary[Security](/categories/security)

promptphp/intercept-pii-redactor
================================

PII redaction middleware for Laravel AI agents.

v0.1.7(2w ago)10MITPHPPHP ^8.4

Since Jun 19Pushed 2w agoCompare

[ Source](https://github.com/promptphp/intercept-pii-redactor)[ Packagist](https://packagist.org/packages/promptphp/intercept-pii-redactor)[ Docs](https://intercept.promptphp.com)[ RSS](/packages/promptphp-intercept-pii-redactor/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (8)Dependencies (4)Versions (9)Used By (0)

Introduction
------------

[](#introduction)

`PIIRedactor` is a Laravel AI SDK agent middleware that detects and handles sensitive personal or secret-like data before an agent prompt reaches the AI provider.

It can redact, mask, log, block, or fully delegate handling to a custom callback.

Important

This middleware is part of the [Intercept middleware collection](https://github.com/promptphp/intercept). It is designed to catch common structured sensitive data, not to guarantee complete detection of every possible personal identifier.

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

[](#quick-start)

### Installation

[](#installation)

```
composer require promptphp/intercept-pii-redactor
```

You may publish the config or not, the middleware works out of the box.

```
php artisan vendor:publish --tag=intercept-config
```

### Usage

[](#usage)

Return the `PIIRedactor` middleware on an agent's middleware method.

Important

To add middleware to an agent, implement the `HasMiddleware` interface and define a middleware method that returns an array of middleware classes.

```
