Chronicles of a build – the theme framework 11

Having stumbled upon Laravel I’ve been amazed by the simplicity, from a developer point of view, of its usage.
Being able to present a view in code like


really shines. Can I implement anything like that in my experimental framework?

My previous user story

Having right now shipped a site I now need to focus on another theme and would like to be able to use my framework for its implementation, at least in some parts, and there is no better way to do it then creating my own user story.
The previous ones I had created dealt with creating a theme framework as straightforward as possible starting from a user story (written by myself and hence pretty delusional) like this one:

As a developer implementing a single custom post page template I want to be able to show a related products list using code like


to have a list of products related to the post shown on the site. A shorthand version to use default values would be appreciated in the form

New wiser user story

While the objective of what I’ve written above remains the proposed code should change to use a factory method because like


where Controllers is the factory and will use magic methods to look for a registered RelatedProducts controller to create an instance of it, return it and be able to call the show method on it.

I’ll be dealing with this requirement in the next days on the kill_singletons! branch of my GitHub repository.