So I started working with a new framework called Zend Expressive which is the 2nd PSR-7 component based framework which should allow you to get code up and running fairly quick.
Now my problem with expressive is that as your project gets larger your factory boilerplate also increases. So for every Action
class there's a ActionFactory
class paired with it to inject the proper dependencies which we then create an alias to before we dispatch and pass that to our route.
The more action's the more factory boilerplate and I'm trying to figure out how do we cut down on that boiler plate?
As I said in the comments, I don't think there is a universal solution to create factories. I know that you don't use zend-servicemanager, but it comes with a cli command to generate factory classes: https://docs.zendframework.com/zend-servicemanager/console-tools/#generate-factory-for-class
It might give you ideas on how to create a factory generator yourself.
Here's an article about it: http://www.masterzendframework.com/simple-factory-generation-with-factorycreator/