Architecture Overview

The engine owns registered detectors, the default strategy, the enabled flag, optional audit dispatch, and optional NER. It is otherwise stateless with respect to each input string.

flowchart TD Config[config/pii-redactor.php] --> Provider[PiiRedactorServiceProvider] Provider --> Engine[RedactorEngine] Provider --> Strategy[RedactionStrategyFactory] Provider --> Packs[DetectorPackRegistry] Packs --> Engine Facade[Pii facade] --> Engine Engine --> Report[DetectionReport] Engine --> Events[PiiRedactionPerformed]
Facade

Pii::redact(), Pii::scan(), and Pii::extend() are the host-facing entry points.

Engine

Collects detections, resolves overlap, applies strategy replacements, and emits optional audit events.

Reports

DetectionReport exposes totals, detector counts, samples, and array serialization.