My name is
Jurgens du Toit.
Systems Developer.
Problem Solver.
Technology and Solving Problems are my passion. I'm a South African that loves my wife, life, and coding.
I like frameworks. I like working with them, I like writing them. I wrote Backend-PHP, which I’m using personally and at Branded Internet. Unfortunately it has a number of major flaws: It’s not easily unit testable, not really a REST web service, and it doesn’t conform to any popular coding standards. So I wrote Backend-Core as the first step towards addressing these issues.
Backend-Core is only intended as a minimal, core system. It doesn’t implement any application logic or data source abstraction. I decided to focus on the core functionality and design of a RESTful MVC system, and make sure that it works as it should. Eventually I’ll extend it with a seperate code base that will include application and data source logic.
The system is structured into Model, View and Controller components:
I found that a number of MVC systems confuse what should go into the Model and what should go into the Controller. I’m aiming for thin Controllers containing application logic, and thick Models containing the business logic.
Backend-PHP used static global classes quite liberally, without even a thought around dependency injection. This makes unit testing unreliable and a real headache to add to the framework.
Backend-Core, on the other hand, was designed to use constructor injection across the board, and includes a number of unit tests, supported by PHPUnit. This should increase the overall stability of the system.
Something I didn’t understand about REST when I initial wrote Backend-PHP, was that every REST URL should refer to a noun, with the only verbs being GET, POST, PUT and DELETE, as specified by the HTTP request. This resulted in it not complying with REST standards, as a lot of the URLs contained extra verbs, or didn’t refer to nouns directly.
Backend-Core supports the REST / HTTP verbs directly, and uses the same methods as CakePHP to identify which verb to use:
_method
POST variableX_HTTP_METHOD_OVERRIDE
header sent with the requestThis enables it to be used from a Web browser as well as from a REST compliant client.
The code complies with the ZEND coding standard, as enforced by PHP Code Sniffer. It’s documented using the PHPdoc standard. Hopefully this will make it easier for people to contribute to and extend the system.
Feel free to fork, comment and use this.