News Feed
Sections




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

Igor Wiedler:
Stateless Services
April 04, 2013 @ 10:41:50

Igor Wiedler has a recent post to his site about creating stateless services, specifically in the context of using a dependency injection container to manage the objects your application uses.

As more frameworks and libraries, particularly in the PHP world, move towards adopting the Dependency Injection pattern they are all faced with the problem of bootstrapping their application and constructing the object graph. In many cases this is solved by a Dependency Injection Container (DIC). Such a container manages the creation of all the things. The things it manages are services. Or are they?

He notes that, according to some of the principles of domain-driven design, "services" should be stateless - the results of calls to the service shouldn't alter it, it should only depend on the values passed in. He goes on to put this into the context of a DIC and gives an example of the "request service" (and how it violates the DDD principles of statelessness). He talks some about scopes (dependencies) and mutable services. He talks about methods to get around these issues with the "request" instance, ultimately coming to the conclusion that event listeners might be the way to go.

0 comments voice your opinion now!
stateless services dependency injection event listener request

Link: https://igor.io/2013/03/31/stateless-services.html

blog comments powered by Disqus

Similar Posts

Greg Beaver's Blog: Be careful of PEAR 1.4.4 and older installs when uninstalling a package

Segment.io: How to Make Async Requests in PHP

Community News: Zend Framework Security Upgrade (Zend_XmlRpc XXE Issue)

Brandon Savage's Blog: Peer Review: You Have Not Because You Ask Not (Requests & Responses)

Zend Developer Zone: Zend Monthly Newsletter - January


Community Events





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


threedevsandamaybe series community install configure podcast library laravel release interview language wordpress unittest list homestead developer application api code introduction

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