boundwize/structarmed
StructArmed turns architecture decisions into executable checks for Laravel and PHP projects. Start from PSR, MVC, or DDD presets, define your layers and dependency rules in native PHP, then run structarmed analyse to catch violations before they spread.
Architecture fit
composer.json autoload or bootstrap.Http → Actions/Services → Models), and onto the "modular monolith" pattern where each domain namespace becomes a layer.Integration feasibility
composer require --dev, one init --preset, one config file, one CI step. Effort is measured in hours, not sprints.Architecture::define() object, which means layers can be computed, looped, and shared across teams rather than being a bespoke DSL. This is a strong fit for teams that already maintain phpstan.neon and rector.php.--fix support (including YAGNI rules) materially lowers the cost of adoption on a legacy codebase — you can converge rather than freeze the rule set at "what currently passes."Technical risk
app(), facades, ::class strings in config arrays, and event/listener discovery are all patterns where a string-based analyser can produce false positives or false negatives. The YAGNI rules are explicitly scoped to "scanned paths only," which means extension points intended for external consumers will be flagged unless skipped.Key questions to resolve before committing
::class string references — are there documented skip strategies?Stack fit
require-dev only; never in require. Keep it out of production images.structarmed.php at repository root alongside phpstan.neon and pint.json, and add it to CODEOWNERS for the architecture guild.App\Http → Controllers, App\Actions / App\Services → Application, App\Models → Persistence, App\Support / App\Contracts → Shared, with vendor and test paths skipped.Preset::PSR4() and a Laravel-appropriate MVC/DDD preset if available; add Preset::YAGNI() only after the layer rules are stable, because YAGNI produces the highest false-positive volume.Migration path
analyse read-only on the largest service directory. Record violation count, runtime, and a sample of false positives. Gate: fewer than ~5% of findings judged incorrect.--fix on a scheduled branch for the safe subset (YAGNI removals, abstract promotion) and land via normal PR review — never auto-merge.RuleInterface implementations are cheap to write but are now maintained code owned by us.Compatibility
php-parser/AST dependency range does not conflict with PHPStan/Larastan or Rector in composer.lock; these tools commonly share the parser and a version skew will block installation on the whole dev toolchain, not just this package.0.19.*) with a Renovate/Dependabot rule that opens a PR rather than auto-merging, and require a green analyse run as the upgrade test.Sequencing dependencies
Maintenance
fix: in the analyser or parallel worker — those are the changes most likely to alter results silently.Support
Scaling
Failure modes and mitigations
Ramp-up
ClassNode / RuleViolation API is small, and the marker-interface pattern for usage flags is well documented, but it requires comfort with AST-level reasoning and the tool's layer model.TPM verdict
--fix — is real and fills a gap the standard Laravel toolchain leaves open.How can I help you explore Laravel packages today?