You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is something which maybe could be easier as extending a package with something from outside via own is a code is common pattern, which even some design patterns are build on top of it:
In Symfony service tags can be used to mark services with a tag which will then automatically be injected.
In Spiral maybe if service tags are not a way to go, I understand that, but maybe the exist code maybe could be moved into a HelperTrait or Helper Function. So that kind of mechanism of that lines could be more simplified and is provided by the Framework and not all need to copy it to there modules.
Hi @alexander-schranz ,
By design and Single responsibility principe Config object should just provide data for services. If you want to register extensions and processors you need to use something like ExtensionsRegistry and ProcessorsRegistry and pass data from config there.
@butschster thx for your response. Is there simpler example I already have a service which is the Registry. But I think I still need this logic also in my case:
Description
I'm very new to Spiral and looking how I can make my Spiral Modules extendable. I had a look at the following Config code in the Twig Bridge here:
https://github.com/spiral/twig-bridge/blob/0463fab97cdbe2caaeaf41f38c197a372660a22b/src/Config/TwigConfig.php#L32-L41
At the
wire
part here:https://github.com/spiral/twig-bridge/blob/0463fab97cdbe2caaeaf41f38c197a372660a22b/src/Config/TwigConfig.php#L62-L76
This is something which maybe could be easier as extending a package with something from outside via own is a code is common pattern, which even some design patterns are build on top of it:
Visitor Pattern
Pool
Registry
In Symfony service tags can be used to mark services with a tag which will then automatically be injected.
In Spiral maybe if service tags are not a way to go, I understand that, but maybe the exist code maybe could be moved into a HelperTrait or Helper Function. So that kind of mechanism of that lines could be more simplified and is provided by the Framework and not all need to copy it to there modules.
Example
Could the
TwigConfig
could look like this:The text was updated successfully, but these errors were encountered: