PHPackages                             gosuperscript/axiom-tracing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. gosuperscript/axiom-tracing

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

gosuperscript/axiom-tracing
===========================

Opt-in execution tracing for gosuperscript/axiom

v0.6.0(1mo ago)033.0k↓33%MITPHPPHP ^8.4CI passing

Since Feb 10Pushed 1mo agoCompare

[ Source](https://github.com/gosuperscript/axiom-tracing)[ Packagist](https://packagist.org/packages/gosuperscript/axiom-tracing)[ RSS](/packages/gosuperscript-axiom-tracing/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (6)Dependencies (16)Versions (16)Used By (0)

axiom-tracing
=============

[](#axiom-tracing)

Opt-in execution tracing for [gosuperscript/axiom](https://github.com/gosuperscript/axiom).

The package runs a compiled `Program` with an invocation-scoped observer and turns Axiom's ordered node lifecycle into a trace tree. Every evaluated source node records its source class, certified return type, annotations, outcome, value or error, and duration.

Requirements
------------

[](#requirements)

- PHP ^8.4
- gosuperscript/axiom ^0.6
- gosuperscript/monads ^1.0

Installation
------------

[](#installation)

```
composer require gosuperscript/axiom-tracing
```

Usage
-----

[](#usage)

Compile normally, then pass the `Program` to `Tracing::run()`:

```
use Superscript\Axiom\Definitions;
use Superscript\Axiom\Expression;
use Superscript\Axiom\Sources\Coerce;
use Superscript\Axiom\Sources\InfixExpression;
use Superscript\Axiom\Sources\StaticSource;
use Superscript\Axiom\Sources\SymbolSource;
use Superscript\Axiom\Tracing\Tracing;
use Superscript\Axiom\Types\NumberType;

$program = (new Expression(
    source: new InfixExpression(
        new SymbolSource('base'),
        '*',
        new Coerce(new NumberType(), new StaticSource('4')),
    ),
    definitions: new Definitions(['base' => new StaticSource(3)]),
))->compile()->unwrap();

$traced = Tracing::run($program);

$traced->result->unwrap()->unwrap(); // 12
echo $traced->dump();
```

The dump is a real evaluation tree, not a grouped annotation log:

```
InfixExpression [*] — ok, value: 12, 0.1ms
    left: 3
    right: 4
    result: 12
    ├── SymbolSource [base] — ok, value: 3, 0.02ms
    │   memo: miss
    │   result: 3
    │   └── StaticSource [static(int)] — ok, value: 3, 0.005ms
    └── Coerce [Number] — ok, value: 4, 0.02ms
        coercion: string -> int
        └── StaticSource [static(string)] — ok, value: 4, 0.005ms

```

Durations vary by invocation.

Bindings are the optional second argument:

```
$traced = Tracing::run($program, ['amount' => '12']);
```

API
---

[](#api)

ComponentPurpose`Tracing::run(Program, bindings)`Runs one invocation and returns its result with a fresh trace`TracedResult`Pairs the unchanged Axiom `Result` with the root `ExecutionTrace``ExecutionTrace`One source node: children, ordered annotations, timing, outcome, value, and error`TraceCollector`The reusable low-level implementation of Axiom's `Execution\Observer``TraceFormatter`Renders an `ExecutionTrace` as a readable treeRepeated annotations retain their emission order:

```
$trace->get('label');       // last value for this node
$trace->all('result');      // every result annotation on this node
$trace->collect('result');  // result annotations from the whole subtree
$trace->annotations();      // globally ordered within this node
$trace->children();
```

The generic lifecycle data has dedicated accessors: `outcome()`, `durationMs()`, `hasValue()`, `value()`, and `error()`. The underlying Axiom node descriptor is available as `$trace->node`, including `$trace->node->sourceType` and `$trace->node->returns`.

Invocation scope
----------------

[](#invocation-scope)

Tracing state is never attached to a serializable `Source`, an `Expression`, or a compiled `Program`. `Tracing::run()` creates a fresh collector and passes it only to that call, so sequential or concurrent invocations cannot share a trace accidentally.

A boundary admission error happens before compiled source evaluation begins. It is represented as a single `Program` trace node with an `err` outcome. A host exception is still rethrown, preserving `Program` semantics. To inspect such a partial trace, use the collector directly:

```
use Superscript\Axiom\Tracing\TraceCollector;

$collector = new TraceCollector();

try {
    $program->call($bindings, observer: $collector);
} finally {
    $partialTrace = $collector->trace();
}
```

Extension annotations
---------------------

[](#extension-annotations)

Core and host source compilers annotate the node currently being evaluated through `SourceEvaluation::annotate()`:

```
use Superscript\Axiom\CompiledSource;
use Superscript\Axiom\SourceCompilation;
use Superscript\Axiom\SourceEvaluation;

private function compile(MySource $source, SourceCompilation $compilation): CompiledSource
{
    return $compilation->custom($returnType, function (SourceEvaluation $evaluation) use ($service) {
        $value = $service->lookup();
        $evaluation->annotate('cache', 'miss');
        $evaluation->annotate('result', $value);

        return $value;
    });
}
```

Because Axiom wraps every `CompiledSource` with the source identity at compile time, host source compilers participate automatically; they do not need tracing-specific integration.

###  Health Score

49

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~37 days

Total

6

Last Release

30d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14931924?v=4)[Robert van Steen](/maintainers/robertvansteen)[@robertvansteen](https://github.com/robertvansteen)

---

Top Contributors

[![robertvansteen](https://avatars.githubusercontent.com/u/14931924?v=4)](https://github.com/robertvansteen "robertvansteen (12 commits)")[![claude](https://avatars.githubusercontent.com/u/81847?v=4)](https://github.com/claude "claude (1 commits)")[![fawazsuleiman](https://avatars.githubusercontent.com/u/129744165?v=4)](https://github.com/fawazsuleiman "fawazsuleiman (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gosuperscript-axiom-tracing/health.svg)

```
[![Health](https://phpackages.com/badges/gosuperscript-axiom-tracing/health.svg)](https://phpackages.com/packages/gosuperscript-axiom-tracing)
```

###  Alternatives

[proget-hq/phpstan-yii2

Yii2 extension for PHPStan

52614.0k7](/packages/proget-hq-phpstan-yii2)[upscale/swoole-blackfire

Blackfire profiler integration for Swoole web-server

22126.6k13](/packages/upscale-swoole-blackfire)[fjogeleit/prometheus-messenger-middleware

Prometheus Middleware for the Symfony Messenger Component

2255.2k](/packages/fjogeleit-prometheus-messenger-middleware)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
