<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Orite Blog &#187; MVC</title>
	<atom:link href="http://blog.orite.com.au/tag/mvc/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.orite.com.au</link>
	<description>Think Work Learn Share</description>
	<lastBuildDate>Fri, 24 Jul 2009 00:08:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP Frameworks Comparison Test</title>
		<link>http://blog.orite.com.au/web_development/2009-01-17/php-frameworks-comparison-test/</link>
		<comments>http://blog.orite.com.au/web_development/2009-01-17/php-frameworks-comparison-test/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 15:22:49 +0000</pubDate>
		<dc:creator>Frank Liu</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Comparison]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Framework]]></category>
		<category><![CDATA[Yii Framework]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.orite.com.au/?p=19</guid>
		<description><![CDATA[We have done enough reading and digging on the net just to see how others test and compare PHP frameworks, however there are hardly anything recent and convincing. Most of the test are on throughput of a simple 'Hello World' page, which we don't think reflect the real performance of a framework, simply because no [...]]]></description>
			<content:encoded><![CDATA[We have done enough reading and digging on the net just to see how others test and compare PHP frameworks, however there are hardly anything recent and convincing. Most of the test are on throughput of a simple 'Hello World' page, which we don't think reflect the real performance of a framework, simply because no Database interaction was involved, hence Model as in MVC is not tested at all. So we decide to conduct our own test with a more real world case, which would require MVC work together intensively to get up the result.
<h3><span style="text-decoration: underline;">The Test</span></h3>
We have each programmer picked a popular PHP framework, and the task is to setup the framework and create MVC for the benchmark, which involves,
<ul>
	<li>1000 database insertion</li>
	<li>1000 database update</li>
	<li>query 1000 records (all fields), and display in a list</li>
	<li>each record size is about 2kb</li>
</ul>
We then put all the coded project onto one work station which has the following configuration,
<ul>
	<li>Pentium 4, 4.3GHz</li>
	<li>2GB RAM</li>
	<li>Windows XP, SP3</li>
	<li>XAMPP 1.7.0 (<a title="XAMPP 1.7.0 Problem" href="http://blog.orite.com.au/web_development/2009-01-16/xampp-170-for-windows-problem/" target="_self">patched to work with PDO</a>)</li>
	<li>APC enabled (Zend Optimizer disabled)</li>
	<li>All programs turned off, including Anti-Virus and Firewall</li>
</ul>
We use a PHP batch script under CMD to make queries to each framework 10 times, and reports on the average response time and memory usage.
<h3><span style="text-decoration: underline;">The Result</span></h3>
<table width="650" border="0" style="border-collapse: collapse">
  <thead>
    <tr>
      <th width="120">Framework</th>
      <th>Database Engine</th>
      <th>Avg. Response Time</th>
      <th>Avg. Memory Usage</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Pure PHP</td>
      <td>mysqli</td>
      <td>5.28s
      <div style="background:#69F;height:5px;width:53px;font-size:1px;">&nbsp;</div></td>
      <td>0.14MB
      <div style="background:#F90;height:5px;width:2px;font-size:1px;">&nbsp;</div></td>
    </tr>
    <tr>
      <td>oModel*</td>
      <td>adodb mysql</td>
      <td>7.13s
        <div style="background:#69F;height:5px;width:71px;font-size:1px;">&nbsp;</div></td>
      <td>6.88MB
      <div style="background:#F90;height:5px;width:69px;font-size:1px;">&nbsp;</div></td>
    </tr>
    <tr>
      <td><a href="http://www.yiiframework.com/" title="Yii Framework" target="_blank">Yii Framework<br />
      </a>(yiilite)</td>
      <td>pdo_mysql</td>
      <td>7.41s
        <div style="background:#69F;height:5px;width:74px;font-size:1px;">&nbsp;</div></td>
      <td>8.38MB
        <div style="background:#F90;height:5px;width:84px;font-size:1px;">&nbsp;</div></td>
    </tr>
    <tr>
      <td><a href="http://www.yiiframework.com/" title="Yii Framework" target="_blank">Yii Framework</a></td>
      <td>pdo_mysql</td>
      <td>7.7s
        <div style="background:#69F;height:5px;width:74px;font-size:1px;">&nbsp;</div></td>
      <td>9.44MB
        <div style="background:#F90;height:5px;width:94px;font-size:1px;">&nbsp;</div></td>
    </tr>
    <tr>
      <td><a href="http://kohanaphp.com/" title="Kohana Framework" target="_blank">Kohana</a></td>
      <td>mysqli</td>
      <td>7.68s
        <div style="background:#69F;height:5px;width:76px;font-size:1px;">&nbsp;</div></td>
      <td>11.22MB<sup>#</sup>
        <div style="background:#F90;height:5px;width:112px;font-size:1px;">&nbsp;</div></td>
    </tr>
    <tr>
      <td><a href="http://framework.zend.com/" title="Zend Framework" target="_blank">Zend Framework</a></td>
      <td>pdo_mysql</td>
      <td>8.37s
        <div style="background:#69F;height:5px;width:84px;font-size:1px;">&nbsp;</div></td>
      <td>7.99MB
        <div style="background:#F90;height:5px;width:80px;font-size:1px;">&nbsp;</div></td>
    </tr>
    <tr>
      <td><a href="http://framework.zend.com/" title="Zend Framework" target="_blank">Zend Framework</a></td>
      <td>mysqli</td>
      <td>11.28s
        <div style="background:#69F;height:5px;width:113px;font-size:1px;">&nbsp;</div></td>
      <td>7.88MB
        <div style="background:#F90;height:5px;width:79px;font-size:1px;">&nbsp;</div></td>
    </tr>
    <tr>
      <td><a href="http://www.akelos.org/" title="Akelos Framework" target="_blank">Akelos</a></td>
      <td>mysqli</td>
      <td>12.98s
        <div style="background:#69F;height:5px;width:130px;font-size:1px;">&nbsp;</div></td>
      <td>10.93MB
        <div style="background:#F90;height:5px;width:109px;font-size:1px;">&nbsp;</div></td>
    </tr>
  </tbody>
</table>
* The Orite in-house lightweight MVC framework<br />
# With &lt;benchmark&gt; parameter turned off in the database config file, it only uses 1.5MB memory, and takes about 7.8s. Thanks Jeremy Bush for the advice. <i>(updated 24/07/2009)</i>
<h3><span style="text-decoration: underline;">The Verdicts</span></h3>
<table width="650" border="0" style="border-collapse: collapse">
  <thead>
    <tr>
      <th width="120">Framework</th>
      <th width="260">Pro.</th>
      <th>Con.</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>oModel</td>
      <td>Fastest framework, light file structure, highly flexible, real short learning curve</td>
      <td>Not as comprehensive, not well documented, no community support, need high skill set to work on for large-scale project</td>
    </tr>
    <tr>
      <td><a href="http://www.yiiframework.com/" title="Yii Framework" target="_blank">Yii Framework</a></td>
      <td>Fast, comprehensive, simple and secure file structure, strictly php5 OO, well documented, code generation</td>
      <td>Farely new, still building community awareness</td>
    </tr>
    <tr>
      <td><a href="http://kohanaphp.com/" title="Kohana Framework" target="_blank">Kohana</a></td>
      <td>Flexibility, Easy start</td>
      <td>Big memory footprint, DB feature incomplete</td>
    </tr>
    <tr>
      <td><a href="http://framework.zend.com/" title="Zend Framework" target="_blank">Zend Framework</a></td>
      <td>Great library set, flexible, best community support</td>
      <td>Long learning curve, code generation problem*</td>
    </tr>
    <tr>
      <td><a href="http://www.akelos.org/" title="Akelos Framework" target="_blank">Akelos</a></td>
      <td>Great RoR port, database migration</td>
      <td>Slow, php4</td>
    </tr>
  </tbody>
</table>
* We have try to run Zend-Tool on two workstations, all failed to run
<h3><span style="text-decoration: underline;">The Conclusion</span></h3>
We understand this benchmark comparison is still bit off the real world, as it has too much emphasis on the database operation, where as in real web scenario the result can vary on different server deployment. Also, we didn't test cache mechanisms under each framework, which would play a real important role in the production environment, when server gets lot of hits on dynamic content, the result can be really different depend on project nature. Hopefully Orite will further test  real web project taken most the core features of frameworks in consideration.

If we were after speed, we would stick with oModel which had been the backbone of lots of recent Orite projects. After testing the frameworks, our team had picked both Zend Framework which has the most supportive community and feature set, and Yii Framework the good combination of comprehensive feature, ease of use and performance.

We will start few project based on Yii Framework and continuously keep eyes and hands on Zend.

Interesting findings regarding this topic will be posted after we have dived into these frameworks a bit more.]]></content:encoded>
			<wfw:commentRss>http://blog.orite.com.au/web_development/2009-01-17/php-frameworks-comparison-test/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Searching for The PHP Framework</title>
		<link>http://blog.orite.com.au/web_development/2009-01-16/searching-for-the-php-framework/</link>
		<comments>http://blog.orite.com.au/web_development/2009-01-16/searching-for-the-php-framework/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 02:57:34 +0000</pubDate>
		<dc:creator>Frank Liu</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP Framework]]></category>

		<guid isPermaLink="false">http://blog.orite.com/?p=5</guid>
		<description><![CDATA[Orite dev team have been working on our own MVC PHP dev framework for quite few years, which we utilize Adodb for database abstraction and TemplatePower for View template, and we have the handy oModel (Orite Model) to create all database tables as class objects, so all the database operations are nicely layed out in [...]]]></description>
			<content:encoded><![CDATA[Orite dev team have been working on our own MVC PHP dev framework for quite few years, which we utilize <a title="Adodb Database abstraction" href="http://adodb.sourceforge.net/" target="_blank">Adodb</a> for database abstraction and <a title="TemplatePower php template engine" href="http://templatepower.codocad.com/" target="_blank">TemplatePower</a> for View template, and we have the handy oModel (Orite Model) to create all database tables as class objects, so all the database operations are nicely layed out in 3 layers. However we write our own Control, which consists of lots of inclusions (of classes and libraries) and dirty (not very readable) procedure logic etc.

It's not too much of a hassle to develop on the Orite MVC framework, since the simplicity of it's structure and logic. However in order to do tricks like Ajax, URL rewriting, it requires all the knowledge about PHP MySQL HTML Javascript and Apache, and sometime because the different deployment environment one has to learn different platforms, we have been deploy on Linux (various distro), Windows (different versions) and Solaris.

Although the Orite MVC framework performed for years, we decided to go something else. Since for the new year we are proposing few large-scale community portal sites, which would require more collabrative dev and constant maintenance. Here we set out the feature request for the framework we looking for which must have,
<ul>
	<li>MVC pattern, since its what we familiar and happy with</li>
	<li>No non-sense folder structure, not too flexible or too restricted</li>
	<li>Solid and performance database abstraction layer, support transactions</li>
	<li>Good error handling and reporting</li>
	<li>URL management, routing and filtering</li>
	<li>Layered theme, layout, view</li>
	<li>Code generation</li>
	<li>Strict PHP5 implementation</li>
	<li>Good community support and active development</li>
	<li>Easy learning and start</li>
	<li>Performance and security</li>
</ul>
Would be bonus to have,
<ul>
	<li>Templating</li>
	<li>Ajax</li>
	<li>Caching</li>
	<li>Built-in useful libraries (validation, emailing, etc)</li>
	<li>Shell support for cron jobs</li>
	<li>I18n</li>
	<li>Database migration</li>
</ul>
We know it's not an easy task to find THE right PHP framework to use and stick with, since there are quite few available on the market and all have quite good reputation. Also because the evolving of the technology and vary of our project scope. So we decide to firstly pick a few popular ones and do our own testing and benchmarking, that's the only way to choose properly.

We'll follow up with the results...

If you are using a PHP framework and think that's the best, please feel free to post a comment below.]]></content:encoded>
			<wfw:commentRss>http://blog.orite.com.au/web_development/2009-01-16/searching-for-the-php-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
