<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Panda PHP Components</title>
	
	<link>http://blog.pandaphp.org</link>
	<description>News, updates, ideas and everything else relating to Panda PHP Components</description>
	<pubDate>Tue, 05 Aug 2008 01:27:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/panda-php" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>The Configurable Interface</title>
		<link>http://feedproxy.google.com/~r/panda-php/~3/8dG53LX7TNQ/</link>
		<comments>http://blog.pandaphp.org/index.php/2008/08/04/the-configurable-interface/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 01:27:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[configuration]]></category>

		<category><![CDATA[interface]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.pandaphp.org/?p=8</guid>
		<description><![CDATA[Oftentimes you need to configure an object quickly. Generally, the API offers a series of mutator methods which allow for changing properties within the instance. Where this becomes problematic, is when you have several instances to manage with similar or identical configurations. 
An ideal implementation would look something like this:

$configuration = array(
    [...]]]></description>
			<content:encoded><![CDATA[<p>Oftentimes you need to configure an object quickly. Generally, the API offers a series of mutator methods which allow for changing properties within the instance. Where this becomes problematic, is when you have several instances to manage with similar or identical configurations. </p>
<p>An ideal implementation would look something like this:</p>
<pre class="prettyprint">
$configuration = array(
    'foo' => 123,
    'bar' => true
);

$one = new Thing;
$one->configure($configuration);

$two = new Thing;
$two->configure($configuration);
</pre>
<p><samp><a href="http://code.google.com/p/panda-php/source/browse/trunk/Panda/Configurable/Interface.php">Panda_Configurable_Interface</a></samp> offers a standardized solution: Simply implement the interface and add a <samp>configure()</samp> method to your class.</p>
<h3>A Quick Example</h3>
<p>The interface has a single requirement: the <samp>configure()</samp> method:</p>
<pre class="prettyprint">public function configure(array $configuration = array());</pre>
<p>As you can see, your implementation will need to accept an array as its only parameter. The idea is that the configuration array would contain name and value pairs representing configuration directives (although it could really contain anything) for your class.</p>
<p>Here&#8217;s an example from the recently updated <samp><a href="http://code.google.com/p/panda-php/source/browse/trunk/Panda/Loader/Abstract.php">Panda_Loader_Abstract</a></samp> class:</p>
<pre class="prettyprint">
public function configure(array $configuration = array())
{
    if (array_key_exists('namespace', $configuration)) {
        $this->setNamespace($configuration['namespace']);
    }

    if (array_key_exists('baseDir', $configuration)) {
        $this->setBaseDir($configuration['baseDir']);
    }

    if (array_key_exists('load', $configuration)) {
        if (is_string($configuration['load'])) {
            $this->load($configuration['load']);
        }
        elseif (is_array($configuration['load'])) {
            foreach ($configuration['load'] as $className) {
                $this->load($className);
            }
        }
    }
}
</pre>
<p>And on the front, it looks like this:</p>
<pre class="prettyprint">
$Loader = My_Loader::singleton();
$Loader->configure(array(
	'baseDir' => realpath('../lib'),
	'namespace' => 'Blog',
	'load' => array(
		'FrontController',
		'Request',
		'Route',
		'Controller',
		'Model',
		'View'
	)
));
</pre>
<img src="http://feeds.feedburner.com/~r/panda-php/~4/8dG53LX7TNQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.pandaphp.org/index.php/2008/08/04/the-configurable-interface/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.pandaphp.org/index.php/2008/08/04/the-configurable-interface/</feedburner:origLink></item>
		<item>
		<title>Autoloading with Panda_Loader_Singleton</title>
		<link>http://feedproxy.google.com/~r/panda-php/~3/q1KsT5jgtmg/</link>
		<comments>http://blog.pandaphp.org/index.php/2008/05/04/autoloading-with-panda_loader_singleton/#comments</comments>
		<pubDate>Mon, 05 May 2008 04:14:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Updates]]></category>

		<category><![CDATA[Panda_Loader]]></category>

		<category><![CDATA[spl]]></category>

		<category><![CDATA[spl_autoload]]></category>

		<guid isPermaLink="false">http://blog.pandaphp.org/?p=7</guid>
		<description><![CDATA[I just committed a nifty update to the Panda_Loader package: Panda_Loader_Singleton. Essentially, this update just wraps the existing loader with a singleton; but don&#8217;t be fooled by the simplicity: this makes for a wicked-simple autoloading mechanism.
Implementing this component in your code is useful only when one style of code organization is used &#8212; fortunately, this [...]]]></description>
			<content:encoded><![CDATA[<p>I just committed a nifty update to the <a href="http://code.google.com/p/panda-php/wiki/Panda_Loader">Panda_Loader</a> package: <samp>Panda_Loader_Singleton</samp>. Essentially, this update just wraps the existing loader with a <a href="http://code.google.com/p/panda-php/wiki/Singleton_pattern">singleton</a>; but don&#8217;t be fooled by the simplicity: this makes for a wicked-simple autoloading mechanism.</p>
<p>Implementing this component in your code is useful only when one style of code organization is used &#8212; fortunately, this is the case for most projects. The autoloader simply wraps the existing <samp>load()</samp> method &#8212; but calls it from an instance returned from a static <samp>singleton()</samp> call.</p>
<p>When bootstrapping your project, simply register the <samp>autoload()</samp> method and you never have to worry about including dependencies again.</p>
<pre class="prettyprint">
spl_autoload_register(array('Panda_Loader_Singleton', 'autoload'));
</pre>
<p>Check it out yourself: <a href="http://code.google.com/p/panda-php/source/browse/trunk/Panda/Loader/Singleton.php">http://code.google.com/p/panda-php/source/browse/trunk/Panda/Loader/Singleton.php</a></p>
<img src="http://feeds.feedburner.com/~r/panda-php/~4/q1KsT5jgtmg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.pandaphp.org/index.php/2008/05/04/autoloading-with-panda_loader_singleton/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.pandaphp.org/index.php/2008/05/04/autoloading-with-panda_loader_singleton/</feedburner:origLink></item>
		<item>
		<title>New Package: Views</title>
		<link>http://feedproxy.google.com/~r/panda-php/~3/01HBL2ZDBjc/</link>
		<comments>http://blog.pandaphp.org/index.php/2008/04/30/new-package-views/#comments</comments>
		<pubDate>Thu, 01 May 2008 02:02:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://blog.pandaphp.org/?p=6</guid>
		<description><![CDATA[As promised previously, I have committed many interesting view components into the repository. I&#8217;ve written an overview of the package on my personal blog which discusses each part individually.
In summary, Panda_View is a simple package which provides an API for rendering data across various output formats. At the time of this writing, Panda_View can render [...]]]></description>
			<content:encoded><![CDATA[<p>As promised previously, I have committed many interesting view components into the repository. I&#8217;ve written an <a href="http://www.lovemikeg.com/blog/2008/04/28/rolling-your-own-mvc-the-view/">overview of the package</a> on my personal blog which discusses each part individually.</p>
<p>In summary, <samp>Panda_View</samp> is a simple package which provides an API for rendering data across various output formats. At the time of this writing, <samp>Panda_View</samp> can render PHP, JSON, XML, and HTML. New new classes for rendering data is trivial &#8212; in most cases, all that needs to be done is write a <samp>render()</samp> in a class which extends <samp>Panda_View_Abstract</samp>.</p>
<p>More info:</p>
<ul>
<li>I have started a wiki page for the Panda_View package</li>
<li>
		API documentation is available for all libraries:</p>
<ul>
<li><a href="http://docs.pandaphp.org/interface_panda___view___interface.html">Panda_View_Interface</a></li>
<li><a href="http://docs.pandaphp.org/class_panda___view___abstract.html">Panda_View_Abstract</a></li>
<li><a href="http://docs.pandaphp.org/class_panda___view___p_h_p.html">Panda_View_PHP</a></li>
<li><a href="http://docs.pandaphp.org/class_panda___view___j_s_o_n.html">Panda_View_JSON</a></li>
<li><a href="http://docs.pandaphp.org/class_panda___view___x_m_l.html">Panda_View_XML</a></li>
<li><a href="http://docs.pandaphp.org/class_panda___view___h_t_m_l.html">Panda_View_HTML</a></li>
</ul>
</li>
</ul>
<img src="http://feeds.feedburner.com/~r/panda-php/~4/01HBL2ZDBjc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.pandaphp.org/index.php/2008/04/30/new-package-views/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.pandaphp.org/index.php/2008/04/30/new-package-views/</feedburner:origLink></item>
		<item>
		<title>SVN Restructuring</title>
		<link>http://feedproxy.google.com/~r/panda-php/~3/dh8AJauT_tw/</link>
		<comments>http://blog.pandaphp.org/index.php/2008/04/23/svn-restructuring/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 04:53:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Updates]]></category>

		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.pandaphp.org/?p=5</guid>
		<description><![CDATA[After getting an idea, I decided to update the structure of the SVN trunk. Up until now, packages were listed directly into the trunk directory. Now, packages are found within a Panda directory which is in the trunk.
This leaves the option available to put other projects at the SVN root which are closely related to [...]]]></description>
			<content:encoded><![CDATA[<p>After getting an idea, I decided to update the structure of the <a href="http://code.google.com/p/panda-php/source/browse/trunk/">SVN trunk</a>. Up until now, packages were listed directly into the trunk directory. Now, packages are found within a Panda directory which is in the trunk.</p>
<p>This leaves the option available to put other projects at the SVN root which are closely related to the Panda project. For example, I have been considering releasing a product with every major release of Panda. So 1.0 could get a blog, 2.0 could be a shopping cart, etc. Each project would get their own directory at the root of the trunk which would also act as that project&#8217;s namespace.</p>
<p>This also makes including Panda source less error prone. For example, if I were to say: </p>
<pre class="prettyprint">require 'View/HTML.php';</pre>
<p>What library did that just come from? Was <samp>View</samp> a PEAR package or was it a Panda package? The problem is that the above require statement is too ambiguous. Granted, the chance that multiple View libraries in one project would be rare, but it&#8217;s never a good idea to assume that.</p>
<p>Panda libraries should be store in a Panda directory and your require statements should also reflect that:</p>
<pre class="prettyprint">require 'Panda/View/HTML.php';</pre>
<p>There. Much better.</p>
<img src="http://feeds.feedburner.com/~r/panda-php/~4/dh8AJauT_tw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.pandaphp.org/index.php/2008/04/23/svn-restructuring/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.pandaphp.org/index.php/2008/04/23/svn-restructuring/</feedburner:origLink></item>
		<item>
		<title>Coming up next: Views</title>
		<link>http://feedproxy.google.com/~r/panda-php/~3/DjDVodAUiEo/</link>
		<comments>http://blog.pandaphp.org/index.php/2008/04/22/coming-up-next-views/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 03:10:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Updates]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[mvc]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">http://blog.pandaphp.org/?p=4</guid>
		<description><![CDATA[I&#8217;ve been exploring MVC framework development on my personal blog in a series of posts called Rolling Your Own MVC. At the time of this writing, I&#8217;m wrapping up the code for my view library which will be immediately rolled into the next update.
As always, an interface and an abstract class is provided but several [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been exploring MVC framework development on my <a href="http://lovemikeg.com/">personal blog</a> in a series of posts called <em>Rolling Your Own MVC</em>. At the time of this writing, I&#8217;m wrapping up the code for my view library which will be immediately rolled into the next update.</p>
<p>As always, an interface and an abstract class is provided but several concrete classes are provided. They are:</p>
<ul>
<li>Panda_View_Interface</li>
<li>Panda_View_Abstract</li>
<li>Panda_View_PHP</li>
<li>Panda_View_JSON</li>
<li>Panda_View_XML</li>
<li>Panda_View_HTML</li>
</ul>
<div>Code and unit tests will be uploaded later this week!</div>
<img src="http://feeds.feedburner.com/~r/panda-php/~4/DjDVodAUiEo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.pandaphp.org/index.php/2008/04/22/coming-up-next-views/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.pandaphp.org/index.php/2008/04/22/coming-up-next-views/</feedburner:origLink></item>
		<item>
		<title>New Package: Panda_Loader</title>
		<link>http://feedproxy.google.com/~r/panda-php/~3/4TJ8dPlerPg/</link>
		<comments>http://blog.pandaphp.org/index.php/2008/03/11/new-package-panda_loader/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 06:10:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Updates]]></category>

		<guid isPermaLink="false">http://blog.pandaphp.org/?p=3</guid>
		<description><![CDATA[Panda_Loader was written to provide a normalized API to loading source code into applications. An abstract class is provided to offer a base level of functionality, or if you prefer to roll your own, an abstract class is also provided. All Panda libraries with dependencies will use the Panda_Loader API.
More info:

There is a page in [...]]]></description>
			<content:encoded><![CDATA[<p>Panda_Loader was written to provide a normalized API to loading source code into applications. An abstract class is provided to offer a base level of functionality, or if you prefer to roll your own, an abstract class is also provided. All Panda libraries with dependencies will use the Panda_Loader API.</p>
<p>More info:</p>
<ul>
<li>There is a <a href="http://code.google.com/p/panda-php/wiki/Panda_Loader">page in the wiki</a> that gives a quick overview of how the library is used.</li>
<li>API documentation is available for <a href="http://docs.pandaphp.org/interface_panda___loader___interface.html">Panda_Loader_Interface</a> and <a href="http://docs.pandaphp.org/class_panda___loader___abstract.html">Panda_Loader_Abstract</a></li>
</ul>
<img src="http://feeds.feedburner.com/~r/panda-php/~4/4TJ8dPlerPg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.pandaphp.org/index.php/2008/03/11/new-package-panda_loader/feed/</wfw:commentRss>
		<feedburner:origLink>http://blog.pandaphp.org/index.php/2008/03/11/new-package-panda_loader/</feedburner:origLink></item>
	</channel>
</rss>
