Download the PHP package lucajackal85/pii-sanitizer-php without Composer

On this page you can find all versions of the php package lucajackal85/pii-sanitizer-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pii-sanitizer-php

pii-sanitizer-php

A Monolog 3 processor that removes PII and secrets from log records. It sends each record to the local PII Sanitizer Engine sidecar over a Unix socket and writes back the sanitized result. It works with any PHP application that uses Monolog.

This package is framework-agnostic. For Symfony, use the pii-sanitizer-symfony bundle, which sets it up automatically. A Laravel integration is planned as a separate package.

Install

Requirements: PHP ≥ 8.1 and Monolog ^3. You also need a running PII Sanitizer Engine container whose socket your PHP process can read and write. See Running the engine.

Running the engine

The engine is published as a public Docker image on GitHub's container registry, ghcr.io/lucajackal85/pii-sanitizer-engine, so no login is needed. Its source and full documentation are in pii-sanitizer-engine.

The socket is then at /tmp/pii-sockets/pii_sanitizer.sock. Pass that path to PiiSocketClient, or set it as PII_SOCKET_PATH. The model takes about 10 seconds to load; docker logs pii-sanitizer-engine shows listening on … when it's ready.

To run it next to your app, use configuration guide.

Plain Monolog

The record's message, context and extra are sent together in one request. Objects and exceptions in the context are first normalized with Monolog's NormalizerFormatter, so the engine sees the same data your formatter would.

Using the client directly

PiiSocketClient also works without Monolog, for any string or nested array:

The strategy defaults to MaskingStrategy::Tag. The client always sends it, so the engine's own masking_strategy setting doesn't apply to calls made through this package. The enum lists the strategies the engine accepts: Tag, Hash and Asterisk.

When the sidecar is unavailable

on_failure Behaviour
redact (default) The message becomes [PII_SANITIZER_UNAVAILABLE], context is dropped and extra becomes {"pii_sanitizer":"unavailable"}. The level, channel and timestamp are kept, so alerting still works and nothing leaks.
passthrough The record is logged unchanged. Logs keep flowing but may contain PII.

After a failure the processor stops calling the engine for circuit_breaker_seconds. During that window the failure policy applies straight away, so a dead sidecar doesn't add a timeout to every log line.

Timeouts and latency

The defaults are a 50 ms connect timeout and a 1 s read timeout. On CPU the engine takes about 100–400 ms per string, so log calls are synchronous and add that much latency. Attach the processor only to the channels that leave the box. A read timeout is never retried. The connection is dropped so that a late reply can't be mistaken for the next answer. If a reused connection was closed by the server (for example after a restart), the client retries once on a fresh connection.

Typical engine latency is listed in the engine README.

Development

Releases

Every pull request merged into main is tagged automatically with the next version, and a GitHub Release with the list of merged PRs is published. Packagist picks up new tags on its own.

The version bump is set with a label on the PR:

Label Example
(none) v0.1.0 → v0.1.1
minor v0.1.0 → v0.2.0
major v0.1.0 → v1.0.0
skip-release no new version, e.g. for docs or CI changes

Upgrading from 0.1

In 0.2 the namespace changed from OpenPii\MonologSanitizer\ to Jackal\PiiSanitizer\. The classes and their behaviour are the same, so only the use statements change:

0.1 0.2
OpenPii\MonologSanitizer\Client\PiiSocketClient Jackal\PiiSanitizer\Client\PiiSocketClient
OpenPii\MonologSanitizer\Client\MaskingStrategy Jackal\PiiSanitizer\Client\MaskingStrategy
OpenPii\MonologSanitizer\Client\PiiClientInterface Jackal\PiiSanitizer\Client\PiiClientInterface
OpenPii\MonologSanitizer\Client\PiiClientException Jackal\PiiSanitizer\Client\PiiClientException
OpenPii\MonologSanitizer\Processor\PiiSanitizerProcessor Jackal\PiiSanitizer\Processor\PiiSanitizerProcessor

A search and replace of OpenPii\MonologSanitizer\ with Jackal\PiiSanitizer\ is enough.

License

MIT. See LICENSE.


All versions of pii-sanitizer-php with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
ext-json Version *
monolog/monolog Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package lucajackal85/pii-sanitizer-php contains the following files

Loading the files please wait ...