Architectural question - where to implement new functionalities?


Hello again,
it’s time for another basic question :slight_smile:

Exploring the spryker middleware i ran into a problem - I wanted to export files via middleware pipeline into xml format.
For json, there is already an JsonOutputStreamPlugin in the Process module which uses a JsonWriteStream class. For xml, there is already an XmlWriteStream but unfortunately no XmlOutputStreamPlugin in the Process Module … i think this is because it wasn’t needed until now from any core functionality.

To create such a Plugin, it utilizes the getFactory() method in the plugins getOutputStream() method

public function getOutputStream(string $path): WriteStreamInterface
    return $this->getFactory()

Now the question. If i want to write the new XmlOutputStreamPlugin, should this be done

  1. in the Process Module on project level (factories are available from core) or
  2. by drawing the dependencies to my custom module MyNewModule (the factory methods are not available here)

On the one side, it might be better to have all the custom code in one module
On the other side it might be a bad design to pull dependencies into another module (and this might be much more complicated too)

So, whats the “good” or “clean” approach?



Hello @JimPanse!

Yes, seems you are right about the reason why XmlOutputStreamPlugin is not there.

The best place where you can put XmlOutputStreamPlugin is Process module on the project level because it should be there by design. This plugin opens the internal functionality of the Process module so it should be there.


Hello @valerio8787,

thanks for your response.
There is just one question left. Lets assume, i want to provide a module, that has some xml output functionality that i described … if you now just install my new module to your shop, there is no XmlOutputStreamPlugin in this case … but in my module i need this Plugin (this was the initial reason for my question).
How to resolve this dependency? Or is the modular package design limited just to core code and all custom code must be provided as it is? Or can custom code in “core” packages (at project level) also be described as a dependency?
Or is it better to implement the XmlOutputStreamPlugin in my custom module in this case?

Best regards


If we are talking about a project it would be enough to have this plugin in the Process module. You should not take care of dependencies on a project level.

But in case you want to build a vendor module and provide it for another project, of course, you need to define dependencies. Is it your case? if yes i can provide some possible solutions?


This is just na hypothetical assumption. I think this is somewhat you need to take into account before starting with development …

  1. is all my code limited to this project or
  2. should my functionality reused again for multiple projects

Indeed for 1. it really shouldn’t matter that the code is “spread” all over the project level.

For 2. i think it would be the best case if you have it all into one module and just define your external dependencies in a module composer.json file. All depending modules will be installed automatically with your installation.
But if you depend on another function you also implemented on project level (like in this case with XmlOutputStreamPlugin) i can not imagine how to provide this Plugin in a proper way to have it with your new module automatically.
The only thing i can imagine is to implement this plugin in the same module like the new module. But if you do this and you need the XmlOutputStreamPlugin in another third module, you have a dependency to your whole custom module. This doesn’t seem really clean.

Maybe i am missing something … between “project level” and “spryker core level” … is there a “custom core level” which is not part of spryker, but part of the vendor?

Best regards


You are right. An internal ticket was created. We will add this plugin to the core. For now, you can implement it on project level of Process module.

No, there are not any concepts between the “project level” and “the core level”. I just asking to clarify your question.

Thank you for the feedback.

Best regards