Download the PHP package meritum/structured-logging without Composer

On this page you can find all versions of the php package meritum/structured-logging. 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 structured-logging

meritum/structured-logging

Structured exception logging for the Meritum ecosystem. Provides a domain exception model, a translation pipeline that converts arbitrary exceptions into structured domain exceptions, PSR-3 reporting, and correlation ID enrichment.

Installation

A PSR-3 logger must be registered in your kernel before adding this module. meritum/logger is a zero-dependency option.

Module registration

The module registers the following services:

Service Notes
CorrelationId Singleton. Auto-generates a UUID v4 on first resolution.
CorrelationIdEnricher Tagged as log.context.enrichers. Adds correlation_id to every log entry.
ExceptionTranslator Collects all exception.translator.handlers tagged services.
ExceptionReporter Translates, then logs via the decorated LoggerInterface.
LoggerInterface Decorated with ContextEnrichingLogger to apply registered enrichers.

Domain exceptions

Define your own domain exceptions by extending DomainException:

Every domain exception exposes a structuredData property containing the full structured payload, which lands in the PSR-3 log context:

The detail key carries the per-exception contextual data passed in $context. This is deliberately named to avoid a collision with the PSR-3 context array wrapper that some loggers produce.

Translation pipeline

The translator converts arbitrary Throwable instances into domain exceptions. Handlers are registered as tagged kernel services — the translator collects them automatically at boot.

Defining a handler

Implement TranslationHandler and tag it as exception.translator.handlers in your module:

Higher priority() values win when multiple handlers match the same exception. If no handler matches, the translator wraps the exception in an UnknownException and logs it at error severity.

Using the translator directly

If $e is already a DomainException, it is returned as-is.

Reporting

ExceptionReporter::report() runs the full pipeline — translate, enrich, log — and returns the resulting DomainException for the caller to act on (render a response, rethrow, etc.):

Context enrichment

Enrichers add data to the PSR-3 log context on every log call through the decorated logger. CorrelationIdEnricher is registered automatically. Add your own by implementing ContextEnricher and tagging it:

Use the + operator rather than array_merge so that context values already set by the caller are not overwritten.

Correlation ID

CorrelationId is a singleton auto-generated at boot. It is automatically added to every log entry via CorrelationIdEnricher.

To overwrite the generated ID from an incoming HTTP request header (e.g. in a PSR-15 middleware):

set() validates the value as a UUID v4. Invalid or missing values are silently ignored and the auto-generated ID is preserved — a garbage header from a client is not an exceptional condition.

Severity levels

Case PSR-3 level
Severity::Critical critical
Severity::Error error
Severity::Warning warning
Severity::Info info
Severity::Debug debug

All versions of structured-logging with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
georgeff/kernel Version ^1.6
psr/log 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 meritum/structured-logging contains the following files

Loading the files please wait ...