<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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"
	>

<channel>
	<title>Developer Tutorials' Webmaster Blog &#187; php classes</title>
	<atom:link href="http://www.developertutorials.com/blog/tag/php-classes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.developertutorials.com/blog</link>
	<description>Keeping webmasters up-to-date on technology.</description>
	<pubDate>Tue, 02 Sep 2008 14:59:45 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
	<language>en</language>
			<item>
		<title>Code reuse in PHP frameworks</title>
		<link>http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/</link>
		<comments>http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 23:00:18 +0000</pubDate>
		<dc:creator>Akash Mehta</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[code reuse]]></category>

		<category><![CDATA[codeigniter]]></category>

		<category><![CDATA[framework]]></category>

		<category><![CDATA[php classes]]></category>

		<guid isPermaLink="false">http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/</guid>
		<description><![CDATA[Code reuse: a great boon for web development. With large repositories of PHP code out there, from snippet archives to class databases, PHP is arguably one of the best languages when it comes to existing reusable code.
Of course, it isn&#8217;t nearly that simple. Everyone writes code differently; different naming conventions, different approaches to achieving common [...]]]></description>
			<content:encoded><![CDATA[<p>Code reuse: a great boon for web development. With large repositories of PHP code out there, from snippet archives to <a href="http://phpclasses.org/">class databases</a>, PHP is arguably one of the best languages when it comes to existing reusable code.</p>
<p>Of course, it isn&#8217;t nearly that simple. Everyone writes code differently; different naming conventions, different approaches to achieving common tasks (e.g. configuration), even different ways of interacting with the code (functions, classes static/non-static etc.). The problem is compounded when you start using a framework, with the intention of enforcing some basic convention - convention which your existing code libraries may not follow.</p>
<p><span id="more-5"></span>Frameworks can&#8217;t - and shouldn&#8217;t - include masses of functionality by default; an easy way to extend them with existing code is pretty important.  Of all the PHP frameworks I&#8217;ve tried, <a href="http://codeigniter.com">CodeIgniter</a> seems to have one of the most flexible approaches; drop a class into the libraries folder, and as long as it doesn&#8217;t need data passed through the constructor, chances are it just works. (Slight filename and class name changes might be necessary).</p>
<p>I&#8217;ve managed this effortlessly with an XML parsing class from phpclasses.org: in under two minutes I had added an XML parser interface that I could use just like any native CodeIgniter library.</p>
<p>So, how have your attempts at code reuse inside frameworks gone? I haven&#8217;t had a chance to test CakePHP yet; please comment if you&#8217;ve tried it in the past.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark" style="float:left;">
<div class="d5" style="overflow:hidden">
<div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/&amp;title=Code+reuse+in+PHP+frameworks" title="Add to&nbsp;Del.icio.us">Del.icio.us</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/&amp;title=Code+reuse+in+PHP+frameworks" title="Add to&nbsp;Digg This">Digg This</a></div><div id="socialstyles"><a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/&amp;title=Code+reuse+in+PHP+frameworks" title="Add to&nbsp;Stumble">Stumble</a></div></div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://www.developertutorials.com/blog/php/code-reuse-in-php-frameworks-5/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
