11 months ago, I announced the release of my own custom framework called Mendo Framework. I used my own framework for developing client websites, and only after developing a few projects with it, I decided to bring a major update.
What was wrong?
Dependencies were too tedious to configure
The main reason for this huge refactor was because of the Dependency Injection Container it used, Pimple. Any controllers and view models that needed dependencies (i.e. nearly all of them) had to be registered into Pimple’s container. The composition root grew bigger and bigger and it quickly became a hell.
PSR-7 HTTP abstractions came out
PSR-7 came out for some time and Mendo Framework was still using its own HTTP abstraction. It was high time to delve into it. I found the idea amazing, and it quickly became obvious that this would require a lot of code to be refactored as well as the whole design of the framework’s core (i.e. dispatching logic and router).
Too much of a framework
It felt too much of a framework rather than a set of loosely coupled components. Mendo Framework was already using a set of components, but it was not enough.
Resolve dependencies automatically
The framework uses now its own Dependency Injection Container, which has the ability to automatically resolve all the required dependencies. This reduces a huge amount of code that was necessary for managing the application’s dependencies. Controllers no longer need to be added to the Container as services, as they now get their dependencies automatically resolved through their constructors’ type hints.
Merge Controllers and View Models into Action Models
Controllers had the responsibility to update the Model (Domain Model and View Model). View Models gave the View (templates) an abstraction of the Domain Model ; the View could fetch its own data from the View Model (avoiding binding data from Controllers to View as in most other frameworks). While the idea gave a good separation of concerns, the new version of the framework suggest to merge Controllers and View Models back into Action Models. A series of articles that led to this can be found here: Rethinking MVC.
PSR-7 Middlewares to process the request and return the response
The dispatching logic has been replaced by a stack of middlewares that receive a PSR-7 request, interact with a PSR-7 response and call the next middleware on the stack. The concept drastically improved the code’s cleanliness and is very powerful as you can add your own middleware in the stack. As middlewares use PSR-7 HTTP abstractions, they can potentially be framework-agnostic. As you can manipulate request and response at wish, the framework has no more limits to what you can do and render, and feels therefore much more like only a dispatcher with loosely-coupled components than a framework.
Removed functionnalities that forced tight coupling
A few concepts like the Module, the Default Router, the Abstract Controller, the Error Redirector, etc. have been removed. I realized that these classes among others were forcing the framework to stay in a large part as a monolith framework. The core of the framework has been so drastically simplified, that it now consists of a just a couple of middleware classes and a middleware dispatcher (based on Relay). The framework is now much less a framework and much more a dispatcher and loosely coupled components. Action Models don’t even need to extend any framework-specific abstract class, they are simple invokable objects to which you inject required dependencies.
Mendo Framework renamed to Gobline
I start to hate the word “Framework” and a lot of effort has been made in order to make it feel much less like one. For that reason I decided to rename the framework to Gobline.
Documentation can be found here: Gobline Documentation
Before you use this framework for your own projects, be aware that it is still quite experimental. However, any feedback will be greatly appreciated.
Read more on Reddit