<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 18 Jun 2013 16:33:32 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Rob Allen: Objects in the model layer: Part 2]]></title>
      <guid>http://www.phpdeveloper.org/news/19398</guid>
      <link>http://www.phpdeveloper.org/news/19398</link>
      <description><![CDATA[<p>
<i>Rob Allen</i> <a href="http://akrabat.com/development/objects-in-the-model-layer/">previously posted</a> about some of his practices around the different types of objects in the model layer of his Zend Framework 2 applications. In <a href="http://akrabat.com/php/objects-in-the-model-layer-part-2/">this latest post</a> he follows up and shares some example code for the different types.
</p>
<blockquote>
I previously talked about the terms I use for <a href="http://akrabat.com/development/objects-in-the-model-layer/">objects in the model layer</a> and now it's time to put some code on those bones. Note that,as always, all code here is example code and not production-ready.
</blockquote>
<p>
He includes sample classes related to his "books" examples - a "book" entity (with title, author, id and ISBN), a mapper object to load/save/delete the entity and a service object that provides an interface for the entity to the rest of the application.
</p>]]></description>
      <pubDate>Tue, 02 Apr 2013 11:55:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lukas Smith: Good design is no excuse for wasting time]]></title>
      <guid>http://www.phpdeveloper.org/news/19377</guid>
      <link>http://www.phpdeveloper.org/news/19377</link>
      <description><![CDATA[<p>
In his most recent post <i>Lukas Smith</i> suggests that <a href="http://pooteeweet.org/blog/0/2205#m2205">good design isn't an excuse for wasting time</a>. He's basically saying that Symfony2, because of how it's designed and implemented, isn't a RAD (rapid application development) framework and that it's about time for some layers to be added to help get it there.
</p>
<blockquote>
Symfony 1.x I would put into a category of frameworks focused on RAD, aka rapid application development. [...] So for those people who were happy focusing on the 80% use case Symfony2 is a step back. Suddenly the same features take longer to implement, take longer to modify later on and on top of that the learning curve is steeper.
</blockquote>
<p>
He suggests that work be put into "RAD layers" that can sit on top of Symfony2 and provide some of the more familiar features people are used to from things like CakePHP, Yii and CodeIgniter. There's been <a href="https://github.com/FriendsOfSymfony/FOSRestBundle/blob/master/Resources/doc/5-automatic-route-generation_single-restful-controller.md">a few</a> <a href="http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html">tries</a> to <a href="http://sonata-project.org/bundles/admin/master/doc/index.html">accomplish</a> this with only one getting the closest in his opinion - the <a href="http://rad.knplabs.com/">KnpBundle</a>.
</p>]]></description>
      <pubDate>Thu, 28 Mar 2013 11:51:51 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: Working with Slim Middleware]]></title>
      <guid>http://www.phpdeveloper.org/news/19213</guid>
      <link>http://www.phpdeveloper.org/news/19213</link>
      <description><![CDATA[<p>
On PHPMaster.com <i>Timothy Boronczyk</i> has <a href="http://phpmaster.com/working-with-slim-middleware/">written up a tutorial</a> about using the <a href="http://www.slimframework.com/">Slim microframework</a> as a sort of "middleware" in your application - a wrapper around other functionality with an easier to use interface.
</p>
<blockquote>
<a href="http://www.slimframework.com/">Slim is a microframework</a> that offers routing capabilities for easily creating small PHP applications. But an interesting, and powerful, feature is its concept of Middleware. [...] I've found middleware to be an eloquent solution for implementing various filter-like services in a Slim app, such as authentication and caching. In this article I'll explain how middleware works and share with you a simple cache example that highlights how you can implement your own custom middleware.
</blockquote>
<p>
He talks about what "middleware" is (complete with <a href="http://cdn.phpmaster.com/files/2013/02/middleware.jpg">illustration</a>) and how Slim can be used as a layer in the middleware stack. His example is a caching layer, based on Slim, that takes a request, checks the cache for it and returns it if it exists. If not, it saves the content to a database. He also includes code examples of how to use the "add" method to introduce your middleware libraries into the Slim application.
</p>
<p>
If you'd like more examples, the Slim project has <a href="https://github.com/codeguy/Slim-Extras/tree/master/Middleware">several middleware examples</a> provided in their "extras" github repository.
</p>]]></description>
      <pubDate>Thu, 21 Feb 2013 09:23:24 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[NetTuts.com: Evolving Toward a Persistence Layer]]></title>
      <guid>http://www.phpdeveloper.org/news/18469</guid>
      <link>http://www.phpdeveloper.org/news/18469</link>
      <description><![CDATA[<p>
On NetTuts.com there's a new article posted that introduces you to the concept of a <a href="http://net.tutsplus.com/tutorials/php/evolving-toward-a-persistence-layer/">persistence layer in a PHP application</a>:
</p>
<blockquote>
One of the most confusing design pattern is persistence. The need for an application to persist its internal state and data is so tremendous that there are likely tens - if not hundreds - of different technologies to address this single problem. Unfortunately, no technology is a magic bullet. [...] In this tutorial, I will teach you some best practices to help you determine which approach to take, when working on future applications. I will briefly discuss some high level design concerns and principles, followed by a more detailed view on the Active Record design pattern, combined with a few words about the Table Data Gateway design pattern.
</blockquote>
<p>
Included in the post is a high-level application design with the business logic is at the core and the persistence technology/layer exists outside of it. They show how to create a simple, working solution for a persistence layer to handle a blog post and its contents. It talks about characterization tests, the table gateway design pattern and the possible move to the active record pattern.
</p>]]></description>
      <pubDate>Wed, 12 Sep 2012 10:51:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[PHPMaster.com: An Introduction to Services]]></title>
      <guid>http://www.phpdeveloper.org/news/17771</guid>
      <link>http://www.phpdeveloper.org/news/17771</link>
      <description><![CDATA[<p>
On PHPMaster.com today there's a new article from <i>Alejandro Gervasio</i> introducing you to <a href="http://phpmaster.com/an-introduction-to-services/">the concept of "services"</a>, a layer put on top of your models to make a common API that's easier to reuse.
</p>
<blockquote>
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.
</blockquote>
<p>
He explains the process behind creating a simple domain model (<a href="http://cdn.phpmaster.com/files/2012/02/service_diagram.png">image here</a>)  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. 
</p>]]></description>
      <pubDate>Tue, 03 Apr 2012 13:12:16 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney's Blog: View Layers, Database Abstraction, Configuration, Oh, My!]]></title>
      <guid>http://www.phpdeveloper.org/news/17634</guid>
      <link>http://www.phpdeveloper.org/news/17634</link>
      <description><![CDATA[<p>
<i>Matthew Weier O'Phinney</i> (of the <a href="http://framework.zend.com">Zend Framework</a> project) has <a href="http://mwop.net/blog/zf2-beta3">posted an introduction to some new ZF2 features</a> - view layers, abstraction and configuration updates.
</p>
<blockquote>
Late last week, the Zend Framework community <a href="http://framework.zend.com/zf2/blog/entry/Zend-Framework-2-0-0beta3-Released">2.0.0beta3</a>, the latest iteration of the v2 framework. What have we been busy doing the last couple months? In a nutshell, getting dirty with view layers, database abstraction, and configuration.
</blockquote>
<p>
He covers each topic well, providing code examples for all three - a simple view layer (more <a href="http://packages.zendframework.com/docs/latest/manual/en/zend.view.html#zend.view.quick-start">here</a>), database abstraction functionality (inserting, selecting and TableGateway) and the configuration changes that allow for things like key translation, section inheritance and constant substitution.
</p>]]></description>
      <pubDate>Tue, 06 Mar 2012 13:18:14 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[DevShed: Service Layers in PHP Applications (a Series)]]></title>
      <guid>http://www.phpdeveloper.org/news/17004</guid>
      <link>http://www.phpdeveloper.org/news/17004</link>
      <description><![CDATA[<p>
DevShed has posted a series of tutorials talking about different sorts of service layers in PHP applications - seven of them to be exact:
</p>
<blockquote>
If you're looking for an approachable guide that teaches you how to implement an easily-customizable service layer in PHP, then take a peek at this article series. In a step-by-step fashion, it walks you through the development of a sample web application, which uses a service to perform CRUD operations on a domain model composed of a few user entities.
</blockquote>
<p>Service layer types covered in the series are:</p>
<ul>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Service-Layers-A-Final-Example/">Working with database entities</a>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Services-Layers-Data-Mappers/">Data Mappers</a>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Service-Layers-Database-Adapters/">Database adapters</a>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Service-Layers-Handling-Entity-Collections/">Handling Entity Collections</a>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Service-Layers-User-Services/">User Services</a>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Service-Layers-Dependency-Injection/">Dependency Injections</a>
<li><a href="http://www.devshed.com/c/a/PHP/PHP-Service-Layers-Modeling-Domain-Objects/">Modeling Domain Objects</a>
</ul>]]></description>
      <pubDate>Tue, 18 Oct 2011 08:50:09 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Gonzalo Ayuso's Blog: Database Abstraction Layers in PHP. PDO versus DBAL]]></title>
      <guid>http://www.phpdeveloper.org/news/16579</guid>
      <link>http://www.phpdeveloper.org/news/16579</link>
      <description><![CDATA[<p>
In <a href="http://gonzalo123.wordpress.com/2011/07/11/database-abstraction-layers-in-php-pdo-versus-dbal/">this new post</a> to his blog, <i>Gonzalo Ayuso</i> compares two technologies that can make working with databases in your applications simpler - <a href="http://php.net/manual/en/book.pdo.php">PDO</a> and the Doctrine2 <a href="http://www.doctrine-project.org/projects/dbal/2.0/docs/en">DBAL</a> layer.
</p>
<blockquote>
In fact DBAL isn't a pure database abstraction layer. It's built over PDO. It's a set of PHP classes we can use that gives us features not available with 'pure' PDO. If we use Doctrine2 we're using DBAL behind the scene, but we don't need to use Doctrine2 to use DBAL. We can use DBAL as a database abstraction layer without any ORM. Obiously this extra PHP layer over our PDO extension needs to pay a fee. I will have a look to this fee in this post.
</blockquote>
<p>
He includes a few simple benchmarking scripts that compare similar operations done by either, including memory usage and execution time. PDO comes out on top, obviously, because it's an extension versus a set of PHP libraries that need to be included in the application. He does include examples of a few things he likes that DBAL does that PDO doesn't by default - a transactional mode, type conversion, a simpler binding interface and the ability to nest transactions.
</p>]]></description>
      <pubDate>Tue, 12 Jul 2011 10:14:29 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: You don't need a service layer: Fat controllers are okay]]></title>
      <guid>http://www.phpdeveloper.org/news/16369</guid>
      <link>http://www.phpdeveloper.org/news/16369</link>
      <description><![CDATA[<p>
<i>Jani Hartikainen</i> has a new post to his blog today about why, in your framework-based applications, it's <a href="http://codeutopia.net/blog/2011/05/22/you-dont-need-a-service-layer-fat-controllers-are-okay/">okay to have "fat controllers"</a> instead of a service layer.
</p>
<blockquote>
Here's a counterpoint to the currently popular view of "fat controllers are bad", and the current fad of everyone and their cousin implementing service layers: You don't need one. Fat controllers are okay too.
</blockquote>
<p>
He starts by explaining the "why you don't need a service layer" part, mentioning that keeping it in the controller keeps things simple and keeps your code from having to go through extra hoops just to work correctly. He also points out that, just because he recommends "fat controllers" doesn't mean he's advocating code reuse. In fact, just the opposite:
</p>
<blockquote>
It's fine if you code your things in the controllers, but there comes a point when you should stop that. The moment you realize you're duplicating your code, stop and refactor. This is one of the very basics of software engineering: Avoid duplication by creating functions and classes.
</blockquote>]]></description>
      <pubDate>Mon, 23 May 2011 08:42:15 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Zend Developer Zone: Introduction to DataModeler]]></title>
      <guid>http://www.phpdeveloper.org/news/15056</guid>
      <link>http://www.phpdeveloper.org/news/15056</link>
      <description><![CDATA[<p>
On the Zend Developer Zone today there's the <a href="http://devzone.zend.com/article/12511-DataModeler-Simple-ORM---Part-1-Models">first part of a series</a> from <i>Vic Cherubini</i> about an ORM tool he's created to make pulling data from your database of choice (via PDO objects) simpler - DataModler. This first part looks at creating testable models.
</p>
<blockquote>
DataModeler allows you to create easily testable Models that are not dependent on any datasource. The majority of your logic should take place in the Model, and not the Controller (making your application even easier to test as data sources can be mocked). I try to keep my code as simple as possible, so DataModeler is fairly small. 
</blockquote>
<p>
He talks about how the DataModler tool uses dependency injection and how one primary namespace (DataModlerModel) contains the bulk of the code. He includes code samples showing how to create a simple mode, give the attributes data types and access them via magic "set" and "get" methods. For more information on this ORM tool, check out <a href="http://github.com/leftnode/DataModeler">the latest source</a> on github.
</p>]]></description>
      <pubDate>Wed, 01 Sep 2010 08:49:31 -0500</pubDate>
    </item>
  </channel>
</rss>
