mtownsend/array-redactor
Redact sensitive data from PHP arrays before logging or storing it. Array Redactor masks values by key using dot notation and wildcards, with a configurable replacement string and Laravel support. Keeps passwords, tokens, and personal data out of your logs and dumps.
toArray() model dumps can be written to logs, Sentry/Bugsnag, or a support-tooling UI without leaking credentials and PII. This package is the "last mile" scrubber for those arrays.Consider it when:
password, token, api_key, card_number, ssn) and nested predictably, so key-based matching covers the baseline. Callbacks (1.0.1) let you extend per-key behavior beyond wholesale replacement — partial masking, hashing, or conditional redaction — without leaving the library.Look elsewhere when:
For executives (one paragraph):
We log request and job payloads to debug production issues, and those payloads routinely contain passwords, tokens, and customer PII. Today that protection depends on individual developers remembering to strip fields — which is exactly the kind of control an auditor will probe and an incident will expose. This is a small, MIT-licensed PHP utility that redacts array values before they hit logs, and the latest patch adds callback hooks so teams can mask or hash fields to their own needs instead of working around a one-size-fits-all helper. Roughly a day of integration to materially shrink the blast radius of a log leak and strengthen our GDPR/PCI narrative. My recommendation is unchanged: vendor the implementation into our codebase rather than take it as a dependency. It's a 2019-era library with zero downstream dependents that just shipped its first patch in years — a single 1.0.1 release doesn't give us a support contract, so copying the handful of classes gives us the benefit with none of the supply-chain or upgrade risk. Cost is low; the risk of doing nothing is a recurring, unglamorous audit finding.
For engineering (the pitch and the caveats):
Redactor/SafeLog interface so we can swap implementations, enforce a default key list (password, token, secret, authorization, card_number, ssn, *_key), and unit-test the contract rather than the library. Centralizing custom maskers behind that interface keeps callback logic testable and reviewable.Log::info($request->all()) calls.How can I help you explore Laravel packages today?