Skip to content
Search
DSL · Monolog telemetry bridge

value_normalizer

Definition

/**
 * Create a ValueNormalizer for converting arbitrary PHP values to Telemetry attribute types.
 *
 * The normalizer handles:
 * - null → 'null' string
 * - scalars (string, int, float, bool) → unchanged
 * - DateTimeInterface → unchanged
 * - Throwable → unchanged
 * - arrays → recursively normalized
 * - objects with __toString() → string cast
 * - objects without __toString() → class name
 * - other types → get_debug_type() result
 *
 * Example usage:
 * ```php
 * $normalizer = value_normalizer();
 * $normalized = $normalizer->normalize($value);
 * ```
 */
value_normalizer() : ValueNormalizer

Contributors

Built in the open.

Join us on GitHub
scroll back to top