Open schmengler opened 8 years ago
While ago, but @schmengler how far did you get with this? This really seems where we are/should be going in PHP now that we can write decent HTTP servers directly in PHP given the important changes introduced in version 7.0 & 7.1 and have concurrency frameworks like ReactPHP. No reason why not to apply this model to Magento so your proposal makes perfect sense.
Not very far. We were able to make a demo but very limited functionality. Unfortunately swapping out the Request and Response interfaces is currently not possible because Magento relies on the actual implementation at too many places. I talked to @antonkril about it and they are aware of it, but it doesn't have the highest priority in the backlog. Might take another few years, if there is no big community driven initiative.
@schmengler the headless initiative will get us much closer to the desired state.
Also, have you tried replacing Request with inherited mutable implementation?
I tried to create a PSR-7 compatible implementation and could not see how this would be possible by inheriting from the core implementation. I don't remember which methods exactly were problematic though
ReactPHP (http://reactphp.org/) is an event based PHP server, working similar to node.js. It's not starting a new process for every request so there could be a huge performance boost because the expensive bootstrapping of Magento is not necessary all the time.
However, one has to differentiate between application wide global state and request specific global state, so I expect that we need to do make quite some changes in the object manager.