Skip to content

feat: Add Architecture::import() to compose config from multiple files - #522

Merged
samsonasik merged 5 commits into
0.20.xfrom
add-import
Oct 29, 2026
Merged

samsonasik merged 5 commits into
0.20.xfrom
add-import

Conversation

@samsonasik

@samsonasik samsonasik commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

@NickSdot this is alternative PR from your PR:

Importing Config Files

Use import() to split a large config into per-module files:

<?php

use Boundwize\StructArmed\Architecture;

return Architecture::define()
    ->import(__DIR__ . '/module/Foo/structarmed.php')
    ->import(__DIR__ . '/module/Bar/structarmed.php');

Each imported file returns a callable that receives the root Architecture:

<?php

// module/Foo/structarmed.php
use Boundwize\StructArmed\Architecture;

return static function (Architecture $architecture): void {
    $architecture->layer('Foo', 'module/Foo/src/');
};

Paths in imported files are still resolved from the project root. Imported files can import other files. Changing any imported file invalidates the analysis cache, just like changing the main config.

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@samsonasik samsonasik added this to the 0.20.0 milestone Oct 29, 2026
@samsonasik
samsonasik merged commit 58fde7b into 0.20.x Oct 29, 2026
13 of 14 checks passed
@samsonasik
samsonasik deleted the add-import branch October 29, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant