<?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>Wed, 07 Jan 2009 05:37:48 -0600</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Jani Hartikainen's Blog: Decoupling models from the database: Data Access Object pattern in PHP]]></title>
      <guid>http://www.phpdeveloper.org/news/11675</guid>
      <link>http://www.phpdeveloper.org/news/11675</link>
      <description><![CDATA[<p>
In <a href="http://codeutopia.net/blog/2009/01/05/decoupling-models-from-the-database-data-access-object-pattern-in-php/">this new post</a> to his blog <i>Jani Hartikainen</i> looks at implementing the Data Access Object pattern in your PHP applications.
</p>
<blockquote>
The advantage of this is that you can easily implement different methods to persist objects without having to rewrite parts of your code. I'm again going to use the programming language quiz game I wrote as an example. Since I initially wrote it to use Doctrine ORM directly, and both the old and new code are available, you can easily see how the code was improved.
</blockquote>
<p>
He starts off with a look at the pattern itself (including a diagram of how an example would work with Doctrine) followed by the creation of the models for his Questions example. Add in the factory to create an instance and an exmaple of it in action and you're there.
</p>]]></description>
      <pubDate>Mon, 05 Jan 2009 21:22:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Matthew Weier O'Phinney's Blog: A Simple PHP Publish-Subscribe System]]></title>
      <guid>http://www.phpdeveloper.org/news/11580</guid>
      <link>http://www.phpdeveloper.org/news/11580</link>
      <description><![CDATA[<p>
In a <a href="http://weierophinney.net/matthew/archives/199-A-Simple-PHP-Publish-Subscribe-System.html">new post</a> to his blog <i>Matthew Weier O'Phinney</i> shares a simple publish-subscribe system he's created based on a feature of the Dojo toolkit using the Zend Framework to create an easy notification architecture.
</p>
<blockquote>
The system has elements of Aspect Oriented Programming (AOP), as well as the Observer pattern. Its power, however, is in the fact that an individual object does not need to implement any specific interface in order to act as either a Subject or an Observer; the system is globally available. 
</blockquote>
<p>
The script creates an object that publishes an event. This event then sends off messages to all of the other objects subscribing to it. A code example is included. You also can check out the code from <a href="http://github.com/weierophinney/phly/tree/master/Phly_PubSub">its page on github</a> (as a part of his Phly libraries) and play with it yourself.
</p>]]></description>
      <pubDate>Tue, 16 Dec 2008 10:23:26 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Adam Hosker's Blog: Differences Between PHP 4 and 5]]></title>
      <guid>http://www.phpdeveloper.org/news/11564</guid>
      <link>http://www.phpdeveloper.org/news/11564</link>
      <description><![CDATA[<p>
<i>Adam Hosker</i> has posted <a href="http://zend.is-hacked.com/2008/differences-between-php-4-and-5/">some of the differences</a> between PHP4 and PHP5 to help you make the transition.
</p>
<p>
He's broken it up into a few different sections:
</p>
<ul>
<li>Language Features
<li>Objects
<li>Magic Methods
<li>Selected New Extensions
<li>Error Management
</ul>
<p>
Each of the sections has several subpoints detailing changes, updates and tips. The post is a part of his studies working up to talking the Zend Certified Engineer test.
</p>]]></description>
      <pubDate>Fri, 12 Dec 2008 13:42:49 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Brandon Savage's Blog: Keeping Superglobals Out Of Classes]]></title>
      <guid>http://www.phpdeveloper.org/news/11521</guid>
      <link>http://www.phpdeveloper.org/news/11521</link>
      <description><![CDATA[<p>
In a <a href="http://www.brandonsavage.net/entry/keeping-superglobals-out-of-classes.html">new post</a> to his blog, <i>Brandon Savage</i> makes a suggestion that could help in maintenance and debugging down the road - keep those superglobals out of your classes.
</p>
<blockquote>
Let's ignore the security implications of the above code for just a moment, and focus on just the use of the superglobal. By using the $_POST superglobal array, we're effectively doing two things [in the example code]: relying on the field names and limiting code reuse.
</blockquote>
<p>
He shows how to refactor the example into something a bit more reusable by changing the method call to pass in the given username and password instead of looking to the global for it. He does note, however, that there are some more correct uses for those superglobals:
</p>
<blockquote>
There are some legitimate uses of superglobals in classes. One example is the use of the $_SESSION superglobal, which is often used for things like a user object. But I urge you to do so sparingly, when appropriate, rather than relying heavily on superglobals which are subject to change and may not give you the data you expect.
</blockquote>]]></description>
      <pubDate>Mon, 08 Dec 2008 07:57:24 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: Freezing and Thawing PHP Objects]]></title>
      <guid>http://www.phpdeveloper.org/news/11479</guid>
      <link>http://www.phpdeveloper.org/news/11479</link>
      <description><![CDATA[<p>
<i>Sebastian Bergmann</i> has <A href="http://sebastian-bergmann.de/archives/831-Freezing-and-Thawing-PHP-Objects.html">posted details</a> (and a <a href="http://news.php.net/php.cvs/54561">patch</a>) for freezing and unfreezing objects via the new setAccessible method included in the SPL in PHP 5.3.
</p>
<blockquote>
One of the many new features that have been added for <a href="http://cvs.php.net/viewvc.cgi/php-src/NEWS?view=markup&pathrev=PHP_5_3">PHP 5.3</a> is the setAccessible() method of the ReflectionProperty class that is part of PHP's <a href="http://www.php.net/reflection">Reflection API</a>. This method makes protected and private attributes (unfortunately, the class is called ReflectionProperty instead of ReflectionAttribute) of a class or object accessible for the ReflectionProperty::getValue() and ReflectionProperty::setValue() methods, thus making protected and private attributes "open" for full read and write access from the outside.
</blockquote>
<p>
A bit of code shows how to "freeze" and "thaw" the objects out - creating an object, calling the freeze() method on it to protect it from use, then the thaw() method to bring it back out where it can be accessed. <a href="http://www.priebsch.de/">Stefan Priebsch</a> helped to create this class and the <a href="http://news.php.net/php.cvs/54561">patch</a>.
</p>]]></description>
      <pubDate>Mon, 01 Dec 2008 11:12:18 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[NETTUTS.com: Real-World OOP With PHP and MySQL]]></title>
      <guid>http://www.phpdeveloper.org/news/11457</guid>
      <link>http://www.phpdeveloper.org/news/11457</link>
      <description><![CDATA[<p>
On the NETTUTS.com site, there's a <a href="http://nettuts.com/tutorials/php/real-world-oop-with-php-and-mysql/">new tutorial</a> that looks to be a basic introduction to the world of Object-oriented programming in PHP.
</p>
<blockquote>
Numerous examples from robots to bicycles have been offered as "easy" explanations of what OOP is. I've opted to show you how OOP works with a real-life example, for a programmer. By creating a MySQL CRUD class you can easily create, read, update and delete entries in any of your projects, regardless of how the database is designed.
</blockquote>
<p>
Their CRUD example not only serves as an introduction to OOP, but can also be an introduction to MySQL support for those that haven't used it before. They create six functions - the four for CRUD and a connect and disconnect. The <A href="http://nettuts.s3.amazonaws.com/135_crud/source.zip">full source</a> is available for download too.
</p>]]></description>
      <pubDate>Wed, 26 Nov 2008 11:41:47 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Eran Galperin's Blog: OO PHP Templating]]></title>
      <guid>http://www.phpdeveloper.org/news/11423</guid>
      <link>http://www.phpdeveloper.org/news/11423</link>
      <description><![CDATA[<p>
On the TechFounder blog, <i>Eran Galperin</i> has <a href="http://www.techfounder.net/2008/11/18/oo-php-templating/">taken a look</a> at object-oriented templating in PHP applications, comparing the older search and replace method with the inclusion of PHP-based templates.
</p>
<blockquote>
PHP as a language can be considered a templating system, as in its root it was meant to modify HTML pages dynamically. The need for more structured templating systems arose as PHP applications have grown more and more complex, giving birth to much more specialized and focused solutions.
</blockquote>
<p>
He illustrates with an object replacement example - parsing the template as a PHP script and replacing any objects found with the corresponding object property value.
</p>]]></description>
      <pubDate>Tue, 18 Nov 2008 13:05:30 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[IBM developerWorks: What's new in PHP V5.3, Part 1: Changes to the object interface]]></title>
      <guid>http://www.phpdeveloper.org/news/11396</guid>
      <link>http://www.phpdeveloper.org/news/11396</link>
      <description><![CDATA[<p>
<i>John Mertic</i> has put together a <a href="http://www.ibm.com/developerworks/opensource/library/os-php-5.3new1/index.html">what's new</a> list in the upcoming PHP 5.3 release:
</p>
<blockquote>
PHP V5.3 is set to be released by the end of 2008, and many of the new features in this release have been in the planning stages for a few years. Originally touted as "PHP V6 without native Unicode support," PHP V5.3 has been developed into a feature-rich upgrade to the PHP V5 line. [...] In this "What's new in PHP V5.3" series, we'll look at these new V5.3 features, and see how they are used and how they can be used in your Web application.
</blockquote>
<p>In this first part of the series he talks about:</p>
<ul>
<li>Improved static method and member handling
<li>The _callStatic() magic method
<li>Dynamic static calls
<li>Late static binding
<li>Standard PHP Library
<li>Circular garbage collection
</ul>]]></description>
      <pubDate>Wed, 12 Nov 2008 11:13:30 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[SitePoint PHP Blog: How to Expose PHP's Private Parts]]></title>
      <guid>http://www.phpdeveloper.org/news/11385</guid>
      <link>http://www.phpdeveloper.org/news/11385</link>
      <description><![CDATA[<p>
On the SitePoint PHP Blog <i>Troels Knak-Nielsen</i> has <A href="http://www.sitepoint.com/blogs/2008/11/11/how-to-expose-phps-private-parts/">worked up a way</a> to "expose PHP's private parts" when it comes to finding out more about the object/variable he's working with (without a usual <a href="http://www.php.net/print_r">print_r</a> or <a href="http://www.php.net/var_dump">var_dump</a>).
</p>
<blockquote>
I've been tinkering with dumping PHP objects, and have found myself constantly running into a brick wall. The output from <a href="http://docs.php.net/manual/en/function.print-r.php">print_r</a> and friends is fine in some contexts, but for larger structures, it would be nice to tidy the output up a bit and wrap it in some HTML.
</blockquote>
<p>
His solution is to serialize the object into a string (keeping all related meta information) that can be passed around and parsed back into its original form for debugging. He's included the script that works bye taking in the string and manually parsing it back out into its parts into a useful array.
</p>]]></description>
      <pubDate>Tue, 11 Nov 2008 09:32:14 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[David Otton's Blog: Neat PHP Tricks: How To Assign References to Globals]]></title>
      <guid>http://www.phpdeveloper.org/news/11375</guid>
      <link>http://www.phpdeveloper.org/news/11375</link>
      <description><![CDATA[<p>
<i>David Otton</i> has a new <a href="http://www.otton.org/2008/11/09/neat-php-tricks-assign-references-globals-workaround/">neat PHP trick</a> posted today - assigning references to global values.
</p>
<blockquote>
What follows isn't so much a PHP trick as a fix for something that really should work, but doesn't. Although the manual implies that the behaviour described below is specific to Zend Engine 1, all my tests were performed against Zend Engine 2.2, PHP 5.2.5.
</blockquote>
<p>
His example compares making a new stdClass both with and without a reference on the it and <a href="http://www.php.net/var_dump">var_dumps</a> out the result. The method with the reference fails silently, however and isn't able to correctly assign it to the global. He recommends a work-around though - setting it directly to the $GLOBALS superglobal.
</p>]]></description>
      <pubDate>Mon, 10 Nov 2008 09:32:18 -0600</pubDate>
    </item>
  </channel>
</rss>
