Download the PHP package lezhnev74/psr-logging-masking-middleware without Composer

On this page you can find all versions of the php package lezhnev74/psr-logging-masking-middleware. 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 psr-logging-masking-middleware

PSR-compatible Logging Masking Middleware

tests codecov PHPStan

A logging middleware for any PSR-7 HTTP client that logs every request and response for later debugging, with secrets redacted - headers, query-string args and body keys masked per message. Built on PSR-7 (messages), PSR-17 (factories, auto-discovered) and PSR-3 (logging), so it works with any PSR-7 impl and PSR-3 logger - none a hard dependency.

Requirements

Installation

Usage

The core is a MessageLogger: give it a PSR-3 logger and a Masker - the config-bound masking policy. It masks each message and writes the exchange as a single debug record. Bodies are masked by content-type - JSON by key (recursively), x-www-form-urlencoded by field name, any other type replaced with a <content-type: N bytes> note so an opaque body never leaks.

One config masks both messages - list every secret name wherever it may appear. MessageMasker's further constructor arguments pin a PSR-17 stream factory or customize the replacement string; pass a NullMasker to the logger to log exchanges unmasked. See tests/MessageLoggerTest.php.

Fluent builder

MessageLoggerBuilder::for($psr3Logger) wires the same MessageLogger in one chain - no hand-built MaskingConfig or MessageMasker:

Call withMaskingConfig() more than once to merge configs (deduped case-insensitively), and placeholder()/replaceWith() share one slot so the last one set wins. See tests/MessageLoggerBuilderTest.php.

Guzzle

HandlerMiddleware::for($logger) returns a generic fn(callable): callable middleware for any handler stack. Push it onto Guzzle's:

See tests/GuzzleClientTest.php and tests/HandlerMiddlewareTest.php.

More

Each is a green test - the executable, always-current spec:

Local development

QA tooling runs in a PHP 8.5 Docker container (with Xdebug) via the dev wrapper - no host PHP needed. ./dev <script> is composer <script> in Docker; anything unrecognized is passed to composer.

Contributing

License

MIT - see LICENSE.


All versions of psr-logging-masking-middleware with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
php-http/discovery Version ^1.19
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/log Version ^2.0 || ^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 lezhnev74/psr-logging-masking-middleware contains the following files

Loading the files please wait ...