Configuration

QuietGuard\Monitor\Config is an immutable value object that every part of the core reads from. There is no config file and no global state, you construct one and pass it to a Reporter.

Constructing a Config

php
use QuietGuard\Monitor\Config;

$config = new Config(
    url: 'https://monitor.example.com',
    key: 'project-token-shown-once',
    timeout: 3,
    release: 'a1b2c3d',
    environments: ['production', 'staging'],
    traceLimit: 0,
);

All properties are public readonly, so a Config cannot be mutated after construction.

Options

ParameterTypeDefaultDescription
url?string(required)Base URL of the Quiet Guard server. Endpoint paths are appended to it; a trailing slash is trimmed.
key?string(required)The per-project API token. Sent as Authorization: Bearer <key>.
timeoutint3Per-request transport timeout, in seconds.
release?stringnullOptional release identifier (e.g. a commit SHA) attached to exception context.
environmentsarray<int,string>[]Report only from these environments; an empty array means all environments.
traceLimitint0Stack-trace frames kept on an exception payload. 0 (the default) ships the full trace; a positive value trims.
redactarray<int,string>every shapeValue shapes masked before sending: email, iban, nir, card, phone. Pass [] to send payloads untouched.
customRedactionsarray<string,string>[]Your own shapes, as label => PCRE pattern. A label of customer_ref masks as [redacted:customer_ref].

Helper methods

php
$config->isConfigured();          // true when both url and key are non-empty
$config->reportsFrom('production'); // true if 'production' is allowed by $environments
  • isConfigured(): bool returns true only when both url and key are non-empty. The Reporter calls this before every send and silently does nothing when the client is not configured.
  • reportsFrom(?string $environment): bool returns true when environments is empty (report everywhere) or when the given environment is in the list. This is the gate an adapter uses to decide whether to report at all in the current environment: the Reporter itself does not call it, so the host decides when to apply it.

A note on release and traceLimit

Config carries release and traceLimit as the single source of truth. When no Payload\ExceptionPayloadBuilder is passed to the Reporter, one is derived from the Config automatically, so both values apply to every report out of the box. Adapters that construct their own builder read them off the Config and pass them in when they wire the Reporter.

You are reading the PHP Core v1.0 documentation.