oxhq/deadcode-laravel
Composer 安装命令:
composer require oxhq/deadcode-laravel
包简介
Laravel dead code pruning with evidence, staged deletion, and rollback
README 文档
README
Laravel dead code pruning with evidence, staged deletion, and rollback.
deadcode-laravel boots the host Laravel app, captures runtime truth, calls the Rust deadcore engine, renders the deadcode.analysis.v1 report, and stages only the conservative removals that the current policy allows.
Command Flow
php artisan deadcode:doctor php artisan deadcode:analyze php artisan deadcode:report --input=storage/app/deadcode/analysis.json --format=json php artisan deadcode:report --input=storage/app/deadcode/analysis.json --format=table php artisan deadcode:apply --input=storage/app/deadcode/analysis.json --dry-run php artisan deadcode:apply --input=storage/app/deadcode/analysis.json --stage php artisan deadcode:rollback
deadcode:analyze {projectPath?} is supervisor-backed. The command sends an analysis task to deadcode-supervisor, streams task progress, and prints the generated deadcode.analysis.v1 payload path.
deadcode:report does not analyze a project. It only renders an existing analysis payload from --input.
deadcode:apply --dry-run explains what would be staged and which findings were skipped. deadcode:apply --stage writes conservative edits and stores rollback data for the latest staged change set.
Installation
Require the package from Packagist and publish configuration:
composer require oxhq/deadcode-laravel php artisan vendor:publish --tag=deadcode-config
For development against the public GitHub repository instead of Packagist:
composer config repositories.deadcode-laravel vcs https://github.com/oxhq/deadcode-laravel composer require oxhq/deadcode-laravel:^0.1.5 php artisan vendor:publish --tag=deadcode-config
Install or build the deadcore binary:
php artisan deadcode:install-binary v0.1.5 php artisan deadcode:install-supervisor v0.1.5
For local development against a source checkout:
php artisan deadcode:install-binary v0.1.5 --source-root=/absolute/path/to/deadcore --prefer-source
Configure explicit binary paths when defaults are not valid for the host app:
DEADCODE_SUPERVISOR_INSTALL_PATH=bin/deadcode-supervisor DEADCODE_SUPERVISOR_BINARY=/absolute/path/to/deadcode-supervisor DEADCODE_SUPERVISOR_TIMEOUT=300 DEADCORE_BINARY=/absolute/path/to/deadcore DEADCORE_SOURCE_ROOT=/absolute/path/to/deadcore DEADCORE_WORKING_DIRECTORY=/absolute/path/to/your/laravel/app DEADCORE_TIMEOUT=120
See docs/installation.md for the longer install path. See docs/fixtures.md for the package fixture map and verification boundaries.
Release Status
v0.1.5 is the current coordinated public release:
deadcode-laravelprovides the Artisan workflow and Laravel runtime snapshot.deadcoreprovides the Rust analysis engine anddeadcode.analysis.v1.go-supervisorprovides the native JSONL worker supervisor used bydeadcode:analyze.
The GitHub releases publish checksum-verified Windows, Linux, and macOS binaries for the native components.
Current Coverage
The current verified slice reports:
- controller methods
- dead controller classes
- explicit typed
FormRequestclasses - direct supported resource usage
- runtime-registered command classes
- runtime-registered listener classes
- explicitly registered subscriber classes
- job classes reached from supported explicit dispatch patterns
- policy classes from the runtime Gate policy map
- model helper methods reached from supported explicit calls
- local scopes reached from supported explicit scope-call patterns
- relationship methods reached from supported explicit access and eager-loading patterns
- legacy and modern accessors/mutators reached from supported explicit reads, writes, and append-style metadata
deadcode:report renders compact reasonSummary values plus structured reachabilityReasons and evidence emitted by deadcore.
deadcode:apply --dry-run explains skipped findings with planner decisions such as report-only category, insufficient confidence, missing range, missing removal plan, or non-isolated removal plan.
Remediation Policy
Auto-removal is limited to high-confidence findings with a matching removal plan for:
unused_controller_methodunused_form_requestunused_resource_classunused_controller_classunused_command_classunused_listener_classunused_subscriber_classunused_job_class
Report-only categories:
unused_policy_classunused_model_methodunused_model_scopeunused_model_relationshipunused_model_accessorunused_model_mutator
Rollback currently restores only the latest staged change set.
Limits
- Controller-class deadness is defined by extracted controller methods.
- Job support is limited to
SomeJob::dispatch(...),dispatch(new SomeJob(...)), andBus::dispatch(new SomeJob(...)). - Model-method support is limited to explicit supported calls from already-reachable surfaces.
- Scope support is limited to explicit conventional scope-call patterns.
- Relationship support is limited to explicit access plus supported eager-loading patterns.
- Accessor support is limited to explicit reads plus append-driven serialization support.
- Mutator support is limited to explicit writes,
setAttribute(...), and supported bulk write paths. - The package renders engine explanations; it does not synthesize deeper reasoning than
deadcoreemitted.
oxhq/deadcode-laravel 适用场景与选型建议
oxhq/deadcode-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「refactoring」 「static-analysis」 「dead-code」 「deadcore」 「code-pruning」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oxhq/deadcode-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oxhq/deadcode-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oxhq/deadcode-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Editable JSON AST with visitor traversal and formatting-preserving printing.
An extensible package of custom Rector rules for automated PHP refactoring and coding standard enforcement.
Validates PHPDoc @param and @return tags against method signatures
Rules for the bdd-analyser CLI tool
Opinionated Rector rules for PHP — strict-assertion enforcement, no @phpstan-ignore, no env-checks in src, no superglobals, PSR Clock requirement, no direct DB / event-dispatch / assert() inside functional tests, and a comment-stripper that keeps only PHPStan tag blocks.
A PHP security linter to detect insecure functions like var_dump, print_r, and other dangerous functions in your codebase
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 40
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-25