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
qossmic/deptrac):
composer require --dev qossmic/deptrac-shim
deptrac.yaml):
vendor/bin/deptrac init
vendor/bin/deptrac analyze
Define layers in deptrac.yaml to enforce Clean Architecture rules:
layers:
- name: Domain
paths: [app/Domain]
- name: Application
paths: [app/Application]
- name: Infrastructure
paths: [app/Infrastructure]
- name: HTTP
paths: [app/Http]
rules:
Domain:
- don't depend on Infrastructure
- don't depend on HTTP
Application:
- don't depend on Infrastructure
HTTP:
- don't depend on Domain
- don't depend on Application
Run with:
vendor/bin/deptrac analyze --fail-on=violation
CI/CD Integration (GitHub Actions example):
- name: Enforce Architecture
run: vendor/bin/deptrac analyze --fail-on=violation
pull_request or push workflows to block violations early.Incremental Adoption:
--fail-on=none to identify violations without blocking builds.--fail-on=violation for critical paths).Layer-Specific Rules:
paths in deptrac.yaml to target specific directories (e.g., tests/ or packages/).layers:
- name: Tests
paths: [tests]
rules:
Tests:
- don't depend on Domain
- don't depend on Application
composer require --dev phpstan/phpstan
vendor/bin/phpstan analyse --level=max
vendor/bin/deptrac analyze --fail-on=violation
deptrac.yaml to enforce project-specific constraints (e.g., "No Http/Controllers dependencies in App/Jobs").vendor/bin/deptrac graph --format=dot > graph.dot
Convert to PNG using Graphviz: dot -Tpng graph.dot -o graph.png.False Positives:
ignore directives:
rules:
HTTP:
- don't depend on Domain
- ignore: ".*\\\\Container.*"
eval) won’t be analyzed. Document exceptions in deptrac.yaml.Performance:
vendor/bin/deptrac analyze --cache=/tmp/deptrac-cache
vendor/, node_modules/).Configuration Quirks:
glob patterns for flexibility:
paths: [app/**/Services/*.php]
deptrac.yaml match filesystem case (e.g., App/Http vs. app/Http).CI/CD Failures:
1 on violations. Configure CI to treat this as a failure:
# GitLab CI example
test:
script:
- vendor/bin/deptrac analyze --fail-on=violation
allow_failure: false
vendor/bin/deptrac analyze --fail-on=none
vendor/bin/deptrac analyze --verbose
deptrac.yaml syntax:
vendor/bin/deptrac validate
deptrac.shared.yaml for common patterns.deptrac.yaml dynamically (e.g., based on environment variables).AppServiceProvider. Document these as exceptions.HTTP layer to avoid false positives:
layers:
- name: HTTP
paths: [app/Http, app/Facades]
layers:
- name: Database
paths: [database/migrations]
rules:
Database:
- ignore: ".*"
How can I help you explore Laravel packages today?