Skip to documentation

metrics

Analyzes code metrics with PhpMetrics.

Overview

The metrics command runs PhpMetrics against the current working directory and forwards the requested report artifacts.

Usage

composer metrics
composer metrics [options]
vendor/bin/dev-tools metrics [options]

Options

--working-dir=<path>

Composer's inherited working-directory option. Use it when you invoke the command through Composer and want to analyze another checkout without changing your current shell session first.

Default: the current working directory.

--exclude=<list>

Comma-separated directories that should be excluded from analysis.

Default: vendor,tmp,cache,spec,build,.dev-tools,backup,resources plus a custom relative workspace directory when --workspace-dir or FAST_FORWARD_WORKSPACE_DIR selects one.

--target=<directory>

Output directory for the generated metrics reports.

Default: selected workspace metrics directory, usually .dev-tools/metrics .

The command writes:

  • the HTML report to the target directory itself;
  • report.json inside the target directory;
  • report-summary.json inside the target directory.
--json
Emit a structured machine-readable payload instead of the normal terminal output.
--pretty-json
Emit the same structured payload with indentation for terminal inspection.
--progress
Enable progress output from PhpMetrics.

Examples

Analyze the current repository with defaults:

composer metrics

Generate an HTML report for manual inspection:

composer metrics --target=.dev-tools/metrics

Generate the full metrics artifact set for CI previews:

composer metrics --target=.dev-tools/metrics

Analyze another checkout through Composer's inherited working directory:

composer --working-dir=packages/example metrics

Behavior

  • the command derives report.json and report-summary.json from the selected --target directory;
  • progress output is disabled by default; use --progress to re-enable it in text mode;
  • --json and --pretty-json keep DevTools itself structured while running PhpMetrics in a quieter mode to avoid polluting the captured payload;
  • it runs PhpMetrics through the active PHP binary and suppresses PhpMetrics deprecation notices emitted by the dependency itself;
  • it keeps PhpMetrics' Composer analysis enabled so the reports include package metadata from the root composer.json and composer.lock , while the default exclusions keep nested fixture projects out of that Composer scan;
  • it limits PhpMetrics' per-package Packagist socket wait so package freshness enrichment cannot leave metrics generation stuck indefinitely.
Search results