<?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>Sun, 19 May 2013 19:33:57 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[PHPMaster.com: Logging with PSR-3 to Improve Reusability]]></title>
      <guid>http://www.phpdeveloper.org/news/19148</guid>
      <link>http://www.phpdeveloper.org/news/19148</link>
      <description><![CDATA[<p>
On PHPMaster.com <i>Patrick Mulvey</i> has written up a new  tutorial looking at <a href="http://phpmaster.com/logging-with-psr-3-to-improve-reusability/">using the PSR-3 logging structure</a> to make a basic logger for your application.
</p>
<blockquote>
Logging is one of the most ubiquitous tasks encountered in PHP. We use logs to track error messages, record important events, and debug problems with our code. In any PHP project, the code is likely to be full of calls to a logging library which handles these actions for us. [...] To promote compatibility between logging libraries, the PHP-FIG group recently released PRS-3, a common interface for logger objects. In this article, I'll discuss how the logger interface defined by PSR-3 allows us to write reusable code that isn't dependent on any particular logging implementation.
</blockquote>
<p>
He includes a quick introduction to the PSR-3 format, how to get the files you'll need to use it (via Composer). He includes some sample code showing how to make the basic email class with a logger injected for use. Since the Monolog logging project follows the PSR-3 format, it's an easy drop-in option. He also talks about using PSR-3 to avoid having logger dependencies with the "LoggerInterface". There's also a bit at the end of the tutorial showing you how to use the Adapter design pattern to "proxy" the logging calls to the class via a PSR-3 interface.
</p>]]></description>
      <pubDate>Thu, 07 Feb 2013 10:22:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Ryan Gantt's Blog: Horizontal reusability with traits in PHP 5.4]]></title>
      <guid>http://www.phpdeveloper.org/news/16765</guid>
      <link>http://www.phpdeveloper.org/news/16765</link>
      <description><![CDATA[<p>
<i>Ryan Gantt</i> has a new tutorial posted to his blog today looking at one of the features in the upcoming PHP 5.4.x releases - traits. Specifically he looks at the <a href="http://zuttonet.com/articles/php-class-traits/">horizontal reusabillity</a> they allow for in your applications.
</p>
<blockquote>
The ability for a class to inherit from multiple parents is maligned by many, but can be a good thing in some situations. For those working in PHP, multiple inheritance has never been an option; classes are limited to one parent, though they can implement many other datatypes through the use of interfaces. Interfaces can lead to code duplication in improperly-factored inheritance hierarchies. Even in well-architected hierarchies, multiple classes that implement similar methods can contain a lot of overlap.
</blockquote>
<p>
He starts with a definition of what traits are and where their real usefulness is (as well as what should be the difference between a class and a trait). He gives an example of a typical hierarchy where two classes extend a parent but then they both need the same functionality. Code duplication's not a possibility and inheritance make run into exposure issues. Traits come to the rescue by dropping in just the feature you need when you need it. His example code shows adding some logging to a simple class via a "Logging" trait and a "Singleton trait" example.
</p>]]></description>
      <pubDate>Wed, 24 Aug 2011 10:42:42 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Ibuildings techPortal: DPCRadio: Designing for Reusability]]></title>
      <guid>http://www.phpdeveloper.org/news/15015</guid>
      <link>http://www.phpdeveloper.org/news/15015</link>
      <description><![CDATA[<p>
On the Ibuildings techPortal today they've posted the latest episode of their DPC Radio podcast series (as recorded at this year's <a href="http://phpconference.nl">Dutch PHP Conference</a>). This episode is <i>Derick Rethans'</i> talk on reusability.
</p>
<blockquote>
This session explain a certain set of design issues for library code that either is often extended, or created with extending and inheritance in mind. There are many ways how a library can be designed to make it both easier to test, as well as for external developers to consume and use. This presentation provides techniques for doing so.
</blockquote>
<p>
You can either listen via the <a href="http://techportal.ibuildings.com/2010/08/25/designing-for-reusability/">in-page player</a> or <a href="http://techportal.ibuildings.com/wp-content/uploads/audio/dpcradio/2010_003.mp3">download the mp3</a> directly. Be sure to check out the <a href="http://techportal.ibuildings.com/author/dpcradio/">other great episodes</a> too!
</p>]]></description>
      <pubDate>Wed, 25 Aug 2010 09:52:53 -0500</pubDate>
    </item>
  </channel>
</rss>
