NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #2109 most downloaded on Packagist
Configurable PHP architecture guards — define your layers and rules, then keep them enforced
Latest stable
0.21.8
Last release 11 days ago
08 Nov 2026
Ships on a steady schedule
a new release about every 8 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
6 months old
251 releases · first in 2026
Drag across the ruler to compare, or tap a release to open it.
 ![PHPStan]
Full Changelog: 0.16.21...0.16.22
Your coding agent can read these notes before it upgrades. Set up the MCP server →
One column per month.
fix: avoid symlink file collection by @samsonasik in #350
Full Changelog: 0.16.20...0.16.21
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.20...0.16.21
perf: avoid redundant canonicalised path in Analyser by @samsonasik in #347
Full Changelog: 0.16.19...0.16.20
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.19...0.16.20
fix: skip Enum on ClassConstantNameMustBeUpperCaseRule by @samsonasik in #345
Full Changelog: 0.16.18...0.16.19
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.18...0.16.19
[test] Add more tests on ArchitectureTest by @samsonasik in #342
Full Changelog: 0.16.17...0.16.18
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.17...0.16.18
fix: Avoid Source layer defined via layerPattern() by @samsonasik in #339
Full Changelog: 0.16.16...0.16.17
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.16...0.16.17
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.13...0.16.14
 ![PHPStan]
 ![PHPStan]
Fix skipRule() treating unregistered rule keys as skip paths by @samsonasik in #330
Full Changelog: 0.16.10...0.16.11
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.10...0.16.11
Released: StructArmed 0.16.11 Latest
Latest
Compare
Fix cyclomatic complexity counting for NullsafePropertyFetch by @samsonasik in #329
Full Changelog: 0.16.9...0.16.10
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.9...0.16.10
Fix cyclomatic complexity counting for null coalescing operators by @samsonasik in #328
Full Changelog: 0.16.8...0.16.9
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.8...0.16.9
fix: Auto-resolve "Source" layer from composer PSR-4 paths when no Source layer is defined by @samsonasik in #326
Full Changelog: 0.16.7...0.16.8
fix: Recognize leading-backslash class-name strings (eg: '\App\Contract') as references and instantiations by @samsonasik in #325
Full Changelog: 0.16.6...0.16.7
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.6...0.16.7
 ![PHPStan]
Full Changelog: 0.16.5...0.16.6
 ![PHPStan]
Full Changelog: 0.16.4...0.16.5
 ![PHPStan]
Full Changelog: 0.16.3...0.16.4
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.2...0.16.3
Full Changelog: 0.16.2...0.16.3
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.1...0.16.2
Full Changelog: 0.16.1...0.16.2
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.16.0...0.16.1
 ![PHPStan]
This release introduces 2 new interfaces:
Boundwize\StructArmed\Rule\UsedInterfaceAwareRuleInterfaceBoundwize\StructArmed\Rule\UsedTraitAwareRuleInterfaceThey complete the existing Boundwize\StructArmed\Rule\ExtendedClassAwareRuleInterface, which was introduced in 0.15.0.
These interfaces are used by the new YAGNI preset to detect abstractions that are not actually used by the scanned codebase.
The preset checks for:
Boundwize\StructArmed\Rule\Rules\Class_\MustBeUsedInterfaceRuleBoundwize\StructArmed\Rule\Rules\Class_\MustBeInterfaceRuleBoundwize\StructArmed\Rule\Rules\Class_\MustBeUsedTraitRuleBoundwize\StructArmed\Rule\Rules\Class_\ExtendedClassMustBeAbstractOrInstantiatedRuleFor the last case, the class can usually be made abstract.
-class SomeClassOnlyExtended
+abstract class SomeClassOnlyExtended
Usage detection also takes references into account, including type hints, instanceof, ::class, static calls, and class-name strings.
All YAGNI rules support --fix. Unused declarations can be removed, while classes that are only extended can be changed to abstract.
You can define YAGNI preset:
<?php
declare(strict_types=1);
use Boundwize\StructArmed\Architecture;
use Boundwize\StructArmed\Preset\Preset;
use Boundwize\StructArmed\Preset\Presets\Psr1Preset;
use Boundwize\StructArmed\Rule\Rules\Class_\MustBeFinalRule;
return Architecture::define()
// ... other config ...
- ->withPresets(Preset::PSR4(), Preset::PSR15());
+ ->withPresets(Preset::PSR4(), Preset::PSR15(), Preset::YAGNI());
The new interfaces are marker interfaces that custom rules can implement instead of the plain Boundwize\StructArmed\Rule\RuleInterface (each marker extends it, so no other change is needed). Collecting usage information costs extra analysis time, so the analyser only computes it when an active rule declares that it needs it via one of these markers:
| Marker interface | Flags populated on ClassNode |
|---|---|
Boundwize\StructArmed\Rule\ExtendedClassAwareRuleInterface |
$isExtended, $isReferenced, $isInstantiated |
Boundwize\StructArmed\Rule\UsedInterfaceAwareRuleInterface |
$isImplemented, $isReferenced |
Boundwize\StructArmed\Rule\UsedTraitAwareRuleInterface |
$isReferenced |
Without a matching marker on at least one active rule, the corresponding flags keep their default false.
For example, a custom rule that requires every interface in a Contracts layer to actually be implemented or referenced:
<?php
namespace App\Architecture\Rules;
use Boundwize\StructArmed\Analyser\ClassNode;
use Boundwize\StructArmed\Rule\RuleViolation;
use Boundwize\StructArmed\Rule\UsedInterfaceAwareRuleInterface;
use function sprintf;
final readonly class ContractMustBeImplementedRule implements UsedInterfaceAwareRuleInterface
{
public function appliesTo(ClassNode $classNode): bool
{
return $classNode->isInterface
&& $classNode->isInLayer('Contracts');
}
public function evaluate(ClassNode $classNode): ?RuleViolation
{
if ($classNode->isImplemented || $classNode->isReferenced) {
return null;
}
return new RuleViolation(
message: sprintf('Contract [%s] must be implemented or referenced', $classNode->className),
file: $classNode->file,
line: $classNode->line,
className: $classNode->className,
layer: $classNode->layer,
);
}
}
The built-in YAGNI preset rules follow this same pattern: MustBeUsedInterfaceRule implements UsedInterfaceAwareRuleInterface, MustBeUsedTraitRule implements UsedTraitAwareRuleInterface, and MustBeUsedAbstractClassRule and ExtendedClassMustBeAbstractOrInstantiatedRule implement ExtendedClassAwareRuleInterface.
See the Reading Usage Flags In A Custom Rule documentation for more details.
YAGNI only knows about usage inside the scanned paths. If a library intentionally exposes interfaces or extension points for external consumers, the relevant rules or paths should be skipped.
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.44...0.16.0
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.34...0.15.35
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
array_keys() when iterating worker file sizes by @samsonasik in https://github.com/boundwize/structarmed/pull/291Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.29...0.15.30
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.28...0.15.29
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.27...0.15.28
 ![PHPStan]
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.25...0.15.26
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.22...0.15.23
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.19...0.15.20
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.18...0.15.19
 ![PHPStan]
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.16...0.15.17
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.9...0.15.10
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.8...0.15.9
 ![PHPStan]
Full Changelog: https://github.com/boundwize/structarmed/compare/0.15.7...0.15.8