codeatlas / exporter-json
CodeAtlas JSON exporter — canonical JSON output conforming to the CodeAtlas schema.
v0.1.1
2026-08-22 19:30 UTC
Requires
- php: ^8.3
- codeatlas/contracts: ^0.1.0
- codeatlas/core: ^0.1.0
Requires (Dev)
- pestphp/pest: ^3.5
This package is not auto-updated.
Last update: 2026-08-23 06:01:36 UTC
README
The canonical JSON exporter — the ONLY contract between the CodeAtlas backend and the UI.
Output document
{
"$schema": "https://codeatlas.dev/schema/v1/analysis.json",
"version": "1.0.0",
"project": { "name", "path", "framework", "framework_version", "php_version" },
"analysis": { "timestamp", "duration_ms", "analyzers" },
"graph": { "nodes": [...], "edges": [...] },
"results": { "<analyzer>": { ... } },
"errors": [ ... ]
}
Full field definitions: JSON_SCHEMA.md at the repository root.
Behaviour guarantees
- Schema version stamped on every document (
$schemaURL +version) - Structurally complete — every top-level block is present even for an empty result; missing project info degrades to
null, never omitted keys - Empty maps serialize as
{}, not[]— PHP's empty-array ambiguity is normalized so TypeScriptRecord<string, T>types parse cleanly prettyPrinthonoured fromExportConfig- Merged pipeline results (
analyzer === 'pipeline') pass through as the per-analyzer map; single-analyzer results are wrapped under their own name
Passing project metadata
ExporterInterface::export() receives only the AnalysisResult, so project info travels via config:
$config = new ExportConfig(options: [ 'project' => [ 'name' => $context->name, 'path' => $context->path, 'framework' => $context->framework, 'framework_version' => $context->frameworkVersion, 'php_version' => $context->phpVersion, ], 'duration_ms' => $pipelineResult->durationMs, ]);
The Laravel bridge does this automatically.
Installation
composer require codeatlas/exporter-json
Part of the CodeAtlas monorepo. MIT © Snova Labs.