carvephp/carve 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

carvephp/carve

Composer 安装命令:

composer require carvephp/carve

包简介

Find service boundaries in Laravel monoliths using static analysis + runtime tracing.

README 文档

README

Find service boundaries in Laravel monoliths using static analysis + runtime tracing.

Tests

CarvePHP is a Laravel-first toolkit that analyzes your existing monolith and produces actionable migration reports. It combines static code analysis with runtime tracing to identify service boundaries with evidence.

Status: v0.1.2-alpha — Preview release. Ready for experimentation and feedback. Not yet production-ready for automatic extraction.

Latest alpha: v0.1.2-alpha

Installation

composer require "carvephp/carve:>=0.1.0-alpha <0.2.0" --dev

After installing, publish the config and run the environment check:

php artisan carve:install
php artisan carve:doctor

Quickstart

# Static scan your codebase
php artisan carve:scan --pretty

# Build dependency graph (combines static + runtime traces)
php artisan carve:analyze

# Detect candidate service boundaries
php artisan carve:boundaries --report=carve-boundaries.md

# Generate full migration report
php artisan carve:report --output=carve-report.md

For better results, enable runtime tracing (optional):

php artisan carve:trace-install
# Follow the instructions, then:
echo "CARVE_TRACE_ENABLED=true" >> .env
php artisan migrate

Sample report snippet:

## Candidate 1: Billing
| Metric       | Value |
|--------------|-------|
| Confidence   | 85.3% |
| Cohesion     | 92.0% |
| Coupling     | 14.7% |
| Risk         | 22.1% |

**Tables:** `invoices`, `payments`, `customers`
**Controllers:** `InvoiceController`, `PaymentController`
**Why suggested:** invoices and payments co-occurred 4× in runtime traces and are both touched by billing routes.

What It Does Today

Feature Status
Static scan (routes, controllers, models, migrations, raw SQL)
Runtime tracing middleware (HTTP + queue + query events)
Dependency graph builder (static + trace merge)
Table affinity clustering for boundary detection
Comprehensive Markdown migration report
Environment doctor command
JSONL + database trace stores

What It Does Not Do (Yet)

Feature Status
Automatic service generation ❌ (planned for v0.2–v0.3)
One-command microservice extraction ❌ (you stay in control)
Database splitting automation ❌ (manual after report)
Production-ready extraction workflow ❌ (v1.0 target)
Shadow / diff mode for extraction validation 🔄 (experimental stub)

Requirements

  • PHP 8.2+
  • Laravel 11, 12, or 13
  • Composer 2.x

Commands

Command Description
carve:install Publish config and migrations
carve:doctor Check environment readiness
carve:scan Run static analysis on the monolith
carve:trace-install Guide runtime tracing setup
carve:analyze Build dependency graph from static scan + traces
carve:boundaries Detect candidate service boundaries
carve:report Generate comprehensive migration report
carve:generate-service Generate service stub (experimental)
carve:generate-openapi Generate OpenAPI stub (experimental)
carve:generate-client Generate client SDK stub (experimental)
carve:shadow Shadow traffic/diff support (experimental)
carve:diff Compare saved shadow responses (experimental)

Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│  Static Scanner  │     │  Runtime Tracer  │     │  Command CLI    │
│  (routes, models,│     │  (middleware,    │     │  (doctor, scan, │
│   migrations,    │────▶│   listeners,     │────▶│   analyze,      │
│   db_usages)     │     │   stores)        │     │   boundaries,   │
└─────────────────┘     └─────────────────┘     │   report)       │
        │                       │                └────────┬────────┘
        ▼                       ▼                         │
┌─────────────────────────────────────────┐                │
│          Graph Builder                   │◀──────────────┘
│  (WeightedGraph + Nodes + Edges)        │
└────────────────┬────────────────────────┘
                 ▼
┌─────────────────────────────────────────┐
│        Boundary Detection                │
│  (TableAffinityClusterer + Scoring)     │
└────────────────┬────────────────────────┘
                 ▼
┌─────────────────────────────────────────┐
│           Report Writer                  │
│  (Markdown + JSON)                      │
└─────────────────────────────────────────┘

Contributing

See CONTRIBUTING.md.

Security

See SECURITY.md.

License

MIT — see LICENSE for details.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-27