Skip to content

Create the functionality needed for fully dynamic and redistributable architecture rules sets #516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
hgraca opened this issue Jun 8, 2025 · 0 comments

Comments

@hgraca
Copy link
Contributor

hgraca commented Jun 8, 2025

Feature Request

Q A
New Feature yes
RFC yes
BC Break no

Summary

I would like to be able to create architecture templates that can be redistributable across projects.

Currently we can define components as

Architecture::withComponents()
            ->component('Domain')->definedBy('Some\Namespace')

however, this means that a component can only be specified by a namespace.

In real-life scenarios I have found it useful to use this not only to define modules in the sense of a namespace, but in the sense of a type of code artifact, for example to define the SharedKernel which is defined at least by the domain events, which can be in any component and cross bounded contexts.

Another case is to define exceptions to a namespace, so we can define a component as everything inside a namespace, except for some specific type of classes, ie the SharedKernel, which is allowed to cross boundaries.

Another case is to define the UseCases, as the only artifacts in the Application layer that can be used by the Presentation or Adapters layers.

Another case is to define the dependencies we conform to, which are exceptions to the 3rd party vendor libraries, but also libraries private to the project or some legacy code in the project, or ...

For more examples, you can look at this and this.

To achieve this level of dynamic rulesets, we need a bunch of stuff though, among others:

  • And expression
  • Or expression
  • Not expression
  • Architecture::definedByExpression(Expression $selector)
  • Improvements to how we show rule breaks (cozz And, Or, Not will create nested expressions that can be complex to read)

and other smaller things that are needed for these.

The good news is that all this is already implemented in a fork and there are no BC breaks.

Is this something that is interesting for you to add to the project?

If so, I can start opening PRs from my fork.

If not, that's also fine, no hard feelings, just let me know.

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

No branches or pull requests

1 participant