Laravel adapter for Codemetry - provides Artisan commands and service provider integration for Git repository analysis.
This package depends on codemetry/core.
Documentation | Getting Started
- PHP 8.2+
- Laravel 11.x or 12.x
- Git
composer require codemetry/laravelThis automatically installs codemetry/core as a dependency.
Publish the configuration file:
php artisan vendor:publish --tag=codemetry-configBoth codemetry/laravel and codemetry/core must be updated together to ensure compatibility:
composer update "codemetry/*"Or explicitly:
composer update codemetry/laravel codemetry/coreNote: Running
composer update codemetry/laravelalone may not work because both packages are versioned together and require matching versions.
# Table output (one row per day)
php artisan codemetry:analyze --days=7
# JSON output
php artisan codemetry:analyze --days=7 --format=json
# Filter by author or branch
php artisan codemetry:analyze --days=7 --author="Jane Doe" --branch=main
# Specify date range
php artisan codemetry:analyze --since=2024-01-01 --until=2024-01-31
# Enable AI-powered explanations (requires API keys in config)
php artisan codemetry:analyze --days=7 --ai=1After publishing, edit config/codemetry.php:
return [
// Number of days to analyze by default
'days' => 7,
// Baseline period for normalization (in days)
'baseline_days' => 56,
// Follow-up fix detection horizon (in days)
'follow_up_horizon_days' => 3,
// AI configuration (optional)
'ai' => [
'enabled' => false,
'engine' => 'openai', // openai, anthropic, deepseek, google
'api_key' => env('CODEMETRY_AI_API_KEY'),
],
];AI integration is opt-in and metrics-only. Engines never receive raw code or diffs.
Supported engines:
- OpenAI
- Anthropic (Claude)
- DeepSeek
When AI is requested but unavailable (missing keys, API failure), analysis continues normally with a warning.
- The AI engine receives aggregated metrics only - never raw source code, full diffs, or file contents.
- All analysis runs locally via Git commands against your repository.
- No data is sent to external services unless AI engines are explicitly enabled.
MIT