News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPMaster.com:
An Introduction to Services
April 03, 2012 @ 13:12:16

On PHPMaster.com today there's a new article from Alejandro Gervasio introducing you to the concept of "services", a layer put on top of your models to make a common API that's easier to reuse.

Don't let the definition freak you out, as if you've been using MVC for a while the chances are you've used a service already. Controllers are often called services, as they carry out application logic and additionally are capable of interfacing to several client layers, namely views. Of course in a more demanding environment, plain controllers fail short in handling several clients without the aforementioned duplicating, so that's why the construction of a standalone layer is more suitable in such cases.

He explains the process behind creating a simple domain model (image here) and shows how the Service layer wraps it up into a simpler interface, leaving the model to handle the business logic. He uses the example of an "EncoderInterface" that's implemented in a "JsonEncoder" and "Serializer" to both provide a "setData" method.

0 comments voice your opinion now!
services tutorial model wrapper layer


blog comments powered by Disqus

Similar Posts

DevShed: An Introduction to Simulating the Model-View-Controller Schema in PHP

Sankho Mallik's Blog: Tutorial: Using Zend_Captcha_Image

SitePoint PHP Blog: How to Create Your Own Twitter Widget in PHP, Part 2

HowToForge: How To Install a Complete LEMP on Ubuntu/Debian

DevShed: Paginating Result Sets for a Search Engine Built with MySQL and PHP 5


Community Events

Don't see your event here?
Let us know!


interview php7 library laravel podcast extension security introduction opinion list language community laravel5 version series framework release api voicesoftheelephpant unittest

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework