qossmic/deptrac-shim
Abandoned shim package providing the deptrac executable via Composer (vendor/bin/deptrac). Install as a dev dependency to run deptrac in projects; for current features and support, use the main repo: https://github.com/qossmic/deptrac
Architecture Fit Deptrac’s core purpose—enforcing architectural constraints via dependency analysis—aligns perfectly with Laravel’s layered architecture (MVC, DDD, or Clean Architecture). The package’s ability to:
App/Http/Controllers from depending on App/Domain/Entities).Integration Feasibility
bindIf(), tag()), limiting its ability to enforce rules on container-registered services. Mitigation: Define explicit layer paths in deptrac.yaml for container-bound classes.Route::get()) may trigger false positives if not properly layered. Mitigation: Exclude vendor/ and configure paths to ignore facade-related files.Job dispatching another Job in a circular fashion). Mitigation: Pair with runtime tests or custom validation.Technical Risk
deptrac.yaml requires careful layer definition. Poorly defined layers (e.g., overlapping paths) may lead to false negatives (missed violations) or false positives (legitimate dependencies flagged).deptrac.yaml and iteratively refine rules.--cache) and run in parallel with other checks.qossmic/deptrac). Future updates may break deptrac.yaml schemas. Mitigation: Pin to 1.0.2 and monitor the main repo for breaking changes.@deptrac-ignore annotations). Risk: Cultural resistance to breaking changes.Key Questions
no-duplicate-classes)? Will it replace or supplement them?App, Domain) or fine-grained (e.g., App/Http, App/Http/Controllers)? Trade-off: finer layers catch more violations but require more maintenance.Stack Fit
vendor/bin/deptrac. No Laravel-specific hooks required.php artisan deptrac).phpunit.xml as a pre-test hook or standalone.Str::camel()-based class names).app() helper (e.g., app()->make() bindings).Migration Path
composer require --dev qossmic/deptrac
vendor/bin/deptrac analyze --fail-on=none
deptrac.yaml:
layers:
- name: Presentation
paths: [app/Http/Controllers, routes]
- name: Application
paths: [app/UseCases]
- name: Domain
paths: [app/Domain]
# GitHub Actions
- name: Deptrac (Warn)
run: vendor/bin/deptrac analyze --fail-on=warning
--fail-on=violation for new features only).Compatibility
8.1–8.3 (Laravel 9/10).7.4 may work but lacks long-term support. Use qossmic/deptrac:0.24.0 if needed.2.x (Laravel’s minimum). No conflicts with Laravel’s platform packages.deptrac:analyze task in PHPStorm).Sequencing
--fail-on=none to identify hotspots (e.g., controllers depending on domain models).ServiceA ↔ ServiceB).deptrac.yaml or codebase.@deptrac-ignore for legacy code).Maintenance
deptrac.yaml will need updates as:
App/Infrastructure for AWS integrations).deptrac.yaml as part of the architecture decision records (ADRs).deptrac:rules:list to audit active rules.2.0.0) may require deptrac.yaml schema updates.1.0.2 and monitor the main repo for breaking changes.Support
Violation: [Presentation] depends on [Domain]).@deptrac-ignore or deptrac.yaml overrides).CONTRIBUTING.md section explaining architectural rules and exceptions.How can I help you explore Laravel packages today?