Download the PHP package azaharizaman/nexus-metric-engine without Composer
On this page you can find all versions of the php package azaharizaman/nexus-metric-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download azaharizaman/nexus-metric-engine
More information about azaharizaman/nexus-metric-engine
Files in azaharizaman/nexus-metric-engine
Package nexus-metric-engine
Short Description Deterministic Layer 1 metric calculation engine for Nexus packages.
License MIT
Homepage https://github.com/azaharizaman/nexus-metric-engine
Informations about the package nexus-metric-engine
Nexus MetricEngine
Deterministic Layer 1 metric calculation engine for Nexus packages.
Nexus\MetricEngine evaluates prepared scalar and time-series inputs against neutral formula definitions. It does not fetch data, persist state, render reports, or attach domain meaning to metrics.
Installation
Requirements
- PHP 8.3 or newer
Basic Usage
Supported Calculations
Scalar primitives:
sumavgminmaxcountratiodeltaabsolute_deltapct_changeweighted_avgweighted_score
Time-series primitives:
rolling_sumrolling_avgperiod_compare
Failure Semantics
MetricEngine fails loudly with package-specific exceptions for invalid formula structure, missing inputs, incompatible input types, invalid numeric values, divide-by-zero operations, invalid windows, and insufficient time-series data.
It does not return fallback values or synthetic zeros unless a caller-defined formula explicitly models that behavior.
Batch Evaluation
Use FormulaCatalog and BatchFormulaEvaluatorService when an application needs status-aware metric runs.
The batch evaluator also accepts a formula list directly:
Enable audit traces when callers need deterministic calculation evidence. Traces include original operands, resolved operands, used input values, dependency results, status, result values, and failure details when present.
Fingerprints
MetricRunFingerprintService returns stable hashes for reproducible runs. The hash is based on canonical serialized formulas, prepared inputs, caller metadata, and the formula dependency graph.
Boundaries
MetricEngine is framework-agnostic. Laravel service providers belong in Laravel adapters or applications.
MetricEngine supports neutral units and precision policies, but currency-specific rules and money value objects belong in finance or accounting packages.