boundwize/structarmed
StructArmed is a dev-only PHP architecture guard: define layers and dependency rules, start from presets (PSR-4/1/12, MVC, DDD), then tune or skip checks in PHP. Run it in CI to catch boundary violations before they become conventions.
Preset::DDD()) to baseline current violations, then iteratively fix them.ruleset() for layer isolation) to align with domain-specific needs (e.g., "API layer must only depend on HTTP").skipClassViolation() for intentional exceptions).Adopt StructArmed if:
Look elsewhere if:
*"StructArmed is a guardrail for our codebase’s architecture, turning our team’s hard-won conventions into automated checks. Think of it like a spellcheck for software design—it catches violations like:
By integrating this into our CI pipeline, we’ll:
It’s low-risk (MIT license, MIT contributor) and high-leverage—we can start with PSR standards, then layer in DDD/MVC rules as we scale. The CLI fits into our existing workflow, and the PHPUnit extension lets us fail builds before tests even run."*
*"StructArmed lets us enforce our architecture rules without manual reviews. Here’s how we’ll use it:
structarmed analyse with Preset::DDD() to see current violations. We’ll fix critical ones immediately, baseline the rest for a smooth migration.->ruleset([
'Domain' => ['Domain'], // Domain can only depend on itself
'Infrastructure' => ['Domain'] // Infrastructure can depend on Domain
]);
This stops ‘Domain leaking into Infrastructure’ bugs before they’re written.phpunit.xml to block merges with violations:
<extensions>
<bootstrap class="Boundwize\StructArmed\PHPUnit\StructArmedExtension"/>
</extensions>
Why now?
src/ directory is growing messy with mixed layer responsibilities.Effort: ~2 hours to configure, then zero ongoing maintenance—it just works in the background."*
How can I help you explore Laravel packages today?