Service Layer and Zend Framework part2

info: for my new implementation with ZF2 and Doctrine2 please check here

Since my last post, I’ve had some time to reflect on my take on a ServiceLayer and do a little experimentation. This time it around it won’t be all talk and no action though, time to get your code-writing-mittens on. For the purpose of this post I have created a GitHub repository, as the series will progress (if it ever will of course) I should end up with a descent, flexible, robust implementation.
A few points are to be made clear before we get our hands dirty. I will only be using stable libraries, so no ZF2 for now, I’ll be sticking to ZF1.11. (Although Matthew Weier O’Phinney wrote a nice introduction about the new plugin broker architecture in ZF2 which will come in handy in situations like this…). Luckily the autoloader rewrite in ZF 1.10 will allow us to use PHP 5.3 namespaces in our library classes. Another new PHP feature that will come in handy will be Late Static Binding.

Continue reading »

Service Layer in PHP

I’ve been thinking about robust, extensible, and easy patterns or strategies for setting up an application. Starting from an MVC viewpoint, I feel there’s a need for an extra layer, a service layer.
The service layer can handle workflow that only represents business logic. This meas the Controllers and Models can focus on their own tasks, being handling request logic and persistence logic respectively.
Service layer is a broad concept, and there are many ideas and examples available, for different languages and frameworks. My goal is to try and sculpt it in such a way that it fits in with PHP and Zend Framework.

Continue reading »