<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://www.h3rald.com/</id>
  <title>H3RALD - Tag 'frameworks' (Atom Feed)</title>
  <updated>2010-04-09T17:30:39Z</updated>
  <link rel="alternate" href="http://www.h3rald.com"/>
  <link rel="self" href="http://www.h3rald.com/tags/frameworks/atom/"/>
  <author>
    <name>Fabio Cevasco</name>
    <uri>http://www.h3rald.com</uri>
  </author>
  <entry>
    <id>tag:www.h3rald.com,2010-04-09:/articles/introducing-glyph/</id>
    <title>Introducing Glyph</title>
    <published>2010-04-09T17:30:39Z</published>
    <updated>2010-04-25T12:22:24Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/introducing-glyph/"/>
    <category term="glyph" scheme="http://www.h3rald.com/tags/glyph/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <category term="frameworks" scheme="http://www.h3rald.com/tags/frameworks/"/>
    <category term="writing" scheme="http://www.h3rald.com/tags/writing/"/>
    <content type="html">
<![CDATA[
<p>I&#8217;ve been writing technical documents for a living for the past four years, and I can tell you: there is no easy way to go about it.</p>
<p>For example, you can use:</p>
<ul>
	<li><strong>a Word Processor</strong> like MS Word, for example &#8212; anyone can do that, right? Sure, but no, thanks: I strongly believe that Word Processors should not be used for writing technical documents as I firmly don&#8217;t believe GUIs are suitable for doing this at a professional level.</li>
	<li><strong>a Document Authoring Software</strong> like Adobe Framemaker, Robohelp, etc. Still GUIs, only more complicated to use.</li>
	<li><strong><span class="caps">XML</span>, like <span class="caps">DITA</span> or DocBook, or other markups</strong>, like ReStructuredText. Better, but still not easily extensible and flexible enough.</li>
	<li><strong>your company&#8217;s tools</strong>, if you have them. That&#8217;s great if they are usable enough and the result makes your boss happy.</li>
	<li><strong>LaTeX</strong>, and that&#8217;s probably your best option, if you know what you&#8217;re doing.</li>
	<li><strong><span class="caps">XHTML</span> and CSS3</strong>, in conjunction with a <span class="caps">PDF</span> renderer like <a href="http://www.princexml.com/">Prince <span class="caps">XML</span></a> &#8212; that&#8217;s great if you know <span class="caps">HTML</span> and <span class="caps">CSS</span>, and you don&#8217;t mind hand-crafting the structure of the document.</li>
</ul>
<h3>Lightweight markups</h3>
<p>I love Textile and Markdown. When people aren&#8217;t looking, I even use them at work to generate <span class="caps">HTML</span> code, because it&#8217;s just so much faster. Textile in particular can be used as a drop-in replacement for <span class="caps">HTML</span> (and a bit of LaTeX, too), as it can produce most inline <span class="caps">HTML</span> tags effortlessly and some block-level tags, too.</p>
<p>For things like <code>&lt;div&gt;</code> tags and <code>&lt;tables&gt;</code> though, Textile is not the best thing in the world, so you normally end up falling back to <span class="caps">HTML</span>.</p>
<p>Another &#8220;problem&#8221; is that <strong>Textile</strong> or other similar lightweight markups cannot be extended easily, simply because they were not meant to be extended in the first place.</p>
<p>Moreover, if you are producing a book, Textile can&#8217;t help you if you want to generate things like a Table of Contents automatically or validate links: those things are simply not part of Textile&#8217;s job.</p>
<h3>How Glyph can help</h3>
<p style="float:right;"><img src="/img/pictures/glyph.png" alt="" /></p>
<p>There are a few projects on the Internet that tackle structured document generation. One of them is <a href="http://github.com/fnando/kitabu">Kitabu</a>, which looks promising and is able to produce pretty documents using Textile and Prince for <span class="caps">PDF</span> rendering&#8230; but again, it&#8217;s not extensible because it relies too much on Textile and Markdown.</p>
<p><a href="/glyph/">Glyph</a> is different. For one, it is much younger than any other, therefore it is most likely full of bugs.</p>
<p>Jokes aside, Glyph follows a much more radical approach, which consists in using a <em>macro language</em> on top of Textile or Markdown. The good thing about it is that this macro language is very simple to learn and &#8212; most importantly &#8212; very easy to extend.</p>
<p>Here&#8217;s an example:</p>
<div class="CodeRay">
  <div class="code"><pre><span class="line-numbers"> <a href="#n1" name="n1">1</a></span>section[header[Something about Glyph]
<span class="line-numbers"> <a href="#n2" name="n2">2</a></span>You can use Glyph macros in conjunction
<span class="line-numbers"> <a href="#n3" name="n3">3</a></span> with _Textile_ or _Markdown_ to
<span class="line-numbers"> <a href="#n4" name="n4">4</a></span>produce HTML files effortlessly.
<span class="line-numbers"> <a href="#n5" name="n5">5</a></span>  section[header[What about PDFs?|pdf]
<span class="line-numbers"> <a href="#n6" name="n6">6</a></span>Once you have a single, well-formatted HTML 
<span class="line-numbers"> <a href="#n7" name="n7">7</a></span>file, converting it to PDF is
<span class="line-numbers"> <a href="#n8" name="n8">8</a></span>extremely easy with a 3rd-party 
<span class="line-numbers"> <a href="#n9" name="n9">9</a></span>renderer like =&gt;[http://www.princexml.com|Prince].
<span class="line-numbers"><strong><a href="#n10" name="n10">10</a></strong></span>  ]   
<span class="line-numbers"><a href="#n11" name="n11">11</a></span>]
</pre></div>
</div>

<p>Which translates to:</p>
<div class="CodeRay">
  <div class="code"><pre><span class="line-numbers"> <a href="#n1" name="n1">1</a></span><span class="entity">&amp;lt;</span>div class=&quot;section&quot;<span class="entity">&amp;gt;</span>
<span class="line-numbers"> <a href="#n2" name="n2">2</a></span>  <span class="entity">&amp;lt;</span>h2 id=&quot;h_1&quot;<span class="entity">&amp;gt;</span>Something about Glyph<span class="entity">&amp;lt;</span>/h2<span class="entity">&amp;gt;</span>
<span class="line-numbers"> <a href="#n3" name="n3">3</a></span>  <span class="entity">&amp;lt;</span>p<span class="entity">&amp;gt;</span>You can use Glyph macros in conjunction with 
<span class="line-numbers"> <a href="#n4" name="n4">4</a></span>     <span class="entity">&amp;lt;</span>em<span class="entity">&amp;gt;</span>Textile<span class="entity">&amp;lt;</span>/em<span class="entity">&amp;gt;</span> or <span class="entity">&amp;lt;</span>em<span class="entity">&amp;gt;</span>Markdown<span class="entity">&amp;lt;</span>/em<span class="entity">&amp;gt;</span> to
<span class="line-numbers"> <a href="#n5" name="n5">5</a></span>     produce HTML files effortlessly.<span class="entity">&amp;lt;</span>/p<span class="entity">&amp;gt;</span>
<span class="line-numbers"> <a href="#n6" name="n6">6</a></span>  <span class="entity">&amp;lt;</span>div class=&quot;section&quot;<span class="entity">&amp;gt;</span>
<span class="line-numbers"> <a href="#n7" name="n7">7</a></span>   <span class="entity">&amp;lt;</span>h3 id=&quot;pdf&quot;<span class="entity">&amp;gt;</span>What about PDFs?<span class="entity">&amp;lt;</span>/h3<span class="entity">&amp;gt;</span>
<span class="line-numbers"> <a href="#n8" name="n8">8</a></span>   <span class="entity">&amp;lt;</span>p<span class="entity">&amp;gt;</span>Once you have a single, well-formatted HTML 
<span class="line-numbers"> <a href="#n9" name="n9">9</a></span>      file, converting it to PDF is
<span class="line-numbers"><strong><a href="#n10" name="n10">10</a></strong></span>      extremely easy with a 3rd-party renderer 
<span class="line-numbers"><a href="#n11" name="n11">11</a></span>      like <span class="entity">&amp;lt;</span>a href=&quot;http://www.princexml.com&quot;<span class="entity">&amp;gt;</span>Prince<span class="entity">&amp;lt;</span>/a<span class="entity">&amp;gt;</span>.<span class="entity">&amp;lt;</span>/p<span class="entity">&amp;gt;</span>
<span class="line-numbers"><a href="#n12" name="n12">12</a></span>  <span class="entity">&amp;lt;</span>/div<span class="entity">&amp;gt;</span>
<span class="line-numbers"><a href="#n13" name="n13">13</a></span><span class="entity">&amp;lt;</span>/div<span class="entity">&amp;gt;</span>
</pre></div>
</div>

<p>Glyph macros can be used to:</p>
<ul>
	<li>Generate block-level <span class="caps">HTML</span> tags not commonly managed by lightweight markups, like <code>head</code>, <code>body</code>, <code>div</code> and <code>table</code>.</li>
	<li>Create and validate internal and external links.</li>
	<li>Include and validate images and figures.</li>
	<li>Automatically determine header levels based on the document structure.</li>
	<li>Automatically generate a Table of Contents based on the document structure.</li>
	<li>Store common snippets of text in a single <span class="caps">YAML</span> file and use them anywhere in your document, as many times as you need.</li>
	<li>Store configuration settings in a <span class="caps">YAML</span> file and use them anywhere in your document, as many times as you need.</li>
	<li>Evaluate Ruby code within your document.</li>
	<li>Call macros from other macros (including snippets), carefully avoiding mutual calls.</li>
	<li>Include text files in other text files.</li>
	<li>Include the contents of configuration settings (author, title) in the document.</li>
	<li>Filter input explicitly or implicitly, based on file extensions when including files.</li>
	<li>Manage comments and todo items.</li>
</ul>
<p>An example Glyph project? Sure, Glyph&#8217;s own guide (<a href="http://github.com/h3rald/glyph/tree/master/book/">source</a> &#8212; <a href="http://github.com/h3rald/glyph/tree/master/book/output/pdf/"><span class="caps">PDF</span> output</a>).</p>
<h3>Technical Details</h3>
<p>Glyph is built on top of the following Ruby Gems:</p>
<ul>
	<li><a href="http://github.com/davetron5000/gli">gli</a> &#8212; For the high-level command line interface.</li>
	<li><a href="http://rake.rubyforge.org/">rake</a> &#8212; For the mid-level interdependent task layer.</li>
	<li><a href="http://treetop.rubyforge.org/">treetop</a> &#8212; For parsing Glyph Language, whose grammar is <a href="http://github.com/h3rald/glyph/blob/master/lib/glyph/glyph_language.treetop">ridiculously simple</a>, but it seems to work so far.</li>
	<li><a href="http://rubyforge.org/projects/extlib/">extlib</a> &#8212; Because I can&#8217;t leave without it.</li>
</ul>
<h3>Disclaimer</h3>
<p>Glyph is <strong>alpha software</strong> (hence the 0.1.0 version number) &#8212; handle with care and be aware that <em>everything</em> could change tomorrow. If you want to keep up-to-date and/or provide feedback, feel free to join <a href="http://groups.google.com/group/glyph-framework">Glyph&#8217;s User Group</a>.</p>
<h3>For more information&#8230;</h3>
<p>&#8230;head over to <a href="/glyph/">Glyph&#8217;s homepage</a>.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2007-07-18:/articles/akelos-interview/</id>
    <title>An Interview with the creator of the Akelos Framework</title>
    <published>2007-07-19T03:02:00Z</published>
    <updated>2009-09-06T18:10:54Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/akelos-interview/"/>
    <category term="php" scheme="http://www.h3rald.com/tags/php/"/>
    <category term="rails" scheme="http://www.h3rald.com/tags/rails/"/>
    <category term="cakephp" scheme="http://www.h3rald.com/tags/cakephp/"/>
    <category term="frameworks" scheme="http://www.h3rald.com/tags/frameworks/"/>
    <content type="html">
<![CDATA[
<p>I <a href="http://www.h3rald.com/blog/34">already</a> <a href="http://www.h3rald.com/blog/38">covered</a> the Akelos <span class="caps">PHP</span> framework in the past, but for those who don&#8217;t know it, Akelos seems to be one of the few <a href="http://www.h3rald.com/articles/rails-inspired-php-frameworks">Rails-inspired <span class="caps">PHP</span> frameworks</a> still worth mentioning, besides CakePHP and Symphony of course.</p>
<p>I recently has a look at their recently-relaunched <a href="http://www.akelos.org/">community website</a> and I noticed this phrase:</p>
<blockquote>
<p>&#8220;Being port of Ruby on Rails to <span class="caps">PHP</span> Akelos is also optimized for programmer happiness and sustainable productivity&#8221;</p>
</blockquote>
<p>Bermi Ferrer, Akelos creator, openly admits the framework is a port of Ruby on Rails to <span class="caps">PHP</span>, an attempt to help <em>&#8220;Ruby on Rails developers who need to code in <span class="caps">PHP</span>&#8221;</em>, among others. Of course Akelos is not Rails, simply because Ruby is (thank God for that!) not <span class="caps">PHP</span>, however I decided to find out more, and I asked Bermi a few questions, which he promptly answered.<h4><em>There are a lot of frameworks for <span class="caps">PHP</span>, perhaps too many: why did you decide to create Akelos rather than using one of the existing ones?</em></h4></p>
<p>I started coding <a href="http://www.akelos.org/">Akelos</a> back in 2004 for our internal developments.  At that time I only found very few frameworks out there like <a href="http://www.mojavi.org/">Mojavi</a> and <a href="http://ez.no/">eZ Publish</a>. These frameworks were not my ideal of an <a href="http://en.wikipedia.org/wiki/Agile_software_development">Agile development</a> environment, so I decided to brew my own solution.</p>
<p>After reading <a href="http://www.martinfowler.com/books.html">Patterns of Enterprise Application Architecture</a> it was clear to me the kind of framework I wanted <a href="http://www.akelos.org/">Akelos</a> to become,  so I started to implement some of the design patterns from the book into Akelos.</p>
<p>During the summer of 2005 I had a look into other <span class="caps">PHP</span> frameworks like <a href="http://www.cakephp.org/">CakePHP</a>, <a href="http://phpontrax.com/"><span class="caps">PHP</span> on Trax</a>, and <a href="http://www.bennolan.com/biscuit/">Biscuit</a> but none of them was more complete or easier to use than what Akelos was already at that time.</p>
<p>Then I used <a href="http://www.rubyonrails.org/">Rails</a> for one small personal project and immediately found that <a href="http://www.akelos.org/">Akelos</a> interfaces, conventions and philosophy were close to the Rails approach. <a href="http://api.rubyonrails.org/files/vendor/rails/activerecord/README.html">Rails ActiveRecord</a> implementation was impressive, better than mine and much much better than other existing <span class="caps">PHP</span> implementations, so I first ported the ActiveRecord code using <a href="http://adodb.sourceforge.net/"><span class="caps">PHP</span> AdoDB</a> as the database abstraction layer.</p>
<p>After that point, whenever I had a problem to solve while coding my customers applications I turned to Rails and they usually had the most elegant solution available. So I did like the idea of digging into Rails code to learn more Ruby and bringing Rails magic to the <span class="caps">PHP</span> world. It also helped the fact that Rails inline documentation is excellent so it could be easily adapted for Akelos.</p>
<h4><em>What&#8217;s new since last time I posted about Akelos?</em></h4>
<p>The biggest change is the direction that the project has taken. Until now we have not dedicated time to promote Akelos, we just used it for our internal projects and we have been adding features as needed without a fixed roadmap or advocacy.</p>
<p>Now this has changed. More and more developers are using Akelos and contributing functionalities they miss from Rails. After some serious contribution proposals and many developers telling us how much they like Akelos, we decided to take the time to build a nice community site which includes <a href="http://forum.akelos.org/">forums</a>, a <a href="http://wiki.akelos.org/">wiki</a>, a new <a href="http://www.akelos.org/docs/tutorials/booklink">tutorial</a> and <a href="http://www.akelos.org/screencasts">a screen-cast</a>.</p>
<p>There are also some improvements like:</p>
<ul>
<li>Sintags, now accepts ruby-like calls to helper methods from the views.</li>
<li>Action Webservice, a component for creating and consuming Web Services easily.</li>
<li>Action Mailer, which allows you to receive and send (directly or in delayed mode) emails from within your application. (this is almost ready to ship)</li>
<li>Acts as tree behavior for Models.</li>
<li>Many performance improvements.</li>
<li>Many small contributions and bug fixes.</li>
<li>Code base reduced from 16MB to 9MB.</li>
</ul>
<h4><em>From the new site, it seems that Akelos is &#8211; or aims to be &#8211; a port of Rails for <span class="caps">PHP</span>. Is that true? Do you aim to target Rails developers as possible users of the framework in situations in which &#8220;they have no choice&#8221; but to use <span class="caps">PHP</span> instead of Ruby?</em></h4>
<p>Akelos has ported many Ruby on Rails components keeping their interfaces and functionality whenever it was feasible to port the Ruby code to <span class="caps">PHP</span>. It might be considered a port in the sense of functionality, but there are some Rails strengths that rely on the Ruby language and that are impossible to port to <span class="caps">PHP</span>. However, Ruby developers will find that Akelos is the <span class="caps">PHP</span> framework with is the closest to Rails.</p>
<p>On the other hand, many <span class="caps">PHP</span> developers have moved to Ruby because <span class="caps">PHP</span> lacked a hyper-productive and fun-to-use framework like Rails for building complex applications. That is no longer the case, and those who excel at <span class="caps">PHP</span> can start being productive from day one by using Akelos. In this way, Akelos target users are those who already know <span class="caps">PHP</span> and need to build complex applications that can run on almost any cheap shared hosting using a solid foundation based on good coding practices and widely accepted conventions.</p>
<h4><em>What Rails features are missing in Akelos?</em></h4>
<p>A standalone webserver like WebBrick, <span class="caps">RJS</span>, has and belongs to many through associations, string/number/date extensions and Active Resource.</p>
<p>Ruby-powered features like modules, runtime class overriding and blocks will never be available in Akelos.</p>
<p>Scaffolds in Akelos work by generating code, I found quite useless to enable $scaffold = true; and have magic functionality that you can&#8217;t modify, so I decided not to invest my time on that one.</p>
<h4><em>I noticed quite a few generators available for Akelos, do they work as a Rails developer may expect them to work?</em></h4>
<p>The ones that are available do pretty much the same as in RoR.</p>
<h4><em>How does Akelos compare to other similar <span class="caps">PHP</span> frameworks like, say, CakePHP? What features does Akelos offer which Cake doesn&#8217;t offer and vice-versa?</em></h4>
<p>I&#8217;m not aware of Cake&#8217;s functionalities. At the time I started porting Rails my feelings about CakePHP were that they missed the simplicity point in favor of architectural discussions that lead to confusing code, but that was long ago.</p>
<p>Akelos (and Rails) do not implement <span class="caps">ACL</span> like Cake does, as that is a business logic component that varies too much from one case to other, it has no place inside the framework.</p>
<p>Akelos is built with internationalization in its core. You can even internationalize your Models by prefixing the column name with the locale.</p>
<p>I think that Cake only has an act_as_tree behavior on models while Akelos has Tree, Nested Set, and List. Akelos also implements handy features from Rails like <a href="http://en.wikipedia.org/wiki/Optimistic_concurrency_control">optimistic locking</a>, <a href="http://www.martinfowler.com/eaaCatalog/lazyLoad.html">lazy loading</a>, <a href="http://www.martinfowler.com/eaaCatalog/singleTableInheritance.html">table inheritance</a>, counters, automatic transactions, really powerful validations, calculations&#8230;, and I think most of these advanced features are still missing on Cake, but maybe I&#8217;m wrong.</p>
<h4><em>Did you include unit tests for all the framework classes?</em></h4>
<p>The main components are fully unit tested, and no new code or patch gets into the trunk without unit tests.</p>
<h4><em>Did you or someone do any performance test or benchmarks on Akelos already?</em></h4>
<p>During the last month a lot of code was refactored to improve performance with the help of <a href="http://xdebug.org/">Xdebug</a>, <a href="http://kcachegrind.sourceforge.net/">Kcachegrind</a> and <a href="http://httpd.apache.org/docs/2.0/programs/ab.html">ab</a>. We significantly improved the performance in one of our most complex intranet applications, a <a href="http://www.basecamphq.com/">basecamp</a>-like system.</p>
<p>Akelos also implements caching at many levels, so it&#8217;s very easy to increase performance as we did with a new <span class="caps">CMS</span> that can handle +200 requests per second using <a href="http://www.apache.org/">Apache</a> in a cheap shared server environment.</p>
<h4><em>Why should a <span class="caps">PHP</span> developer choose Akelos over another <span class="caps">PHP</span> framework?</em></h4>
<p><a href="http://www.akelos.org/docs/tutorials/booklink#mvc">Akelos <span class="caps">MVC</span> implementation</a> and <a href="http://www.akelos.org/docs/tutorials/booklink#workflow">workflow</a> are really easy to understand.</p>
<p>In Akelos all the methods and interfaces are thoroughly selected, so whenever you need to do something you just need to type what you think. Default options are selected with care so you don&#8217;t need to set any  configuration unless you want to modify the default behavior.</p>
<p>Coding multilingual applications, building complex relationships within models, distributing databases changes within your development team, building Ajax interfaces, unit testing your code and many other common tasks for <span class="caps">PHP</span> developers are really simple to accomplish when using Akelos.</p>
<p>Akelos is designed to work on PHP4 and PHP5 and it comes with an easy web installer you can adapt for your application. It has functions for working with files and directories in common situations when the web server runs as a different user.</p>
<p>And one of the main reasons for choosing Akelos is that it makes coding fun and lets you focus on solving user problems rather than wasting your time in repetitive technical annoyances. When coding with other developers the <em>convention over configuration philosophy</em> helps everybody to understand  exactly how everything works and where to find things.</p>
<h4><em>Is there any website using Akelos already?</em></h4>
<p>The <a href="http://www.thechemicalbrothers.com/">Chemical Brothers</a> new website which has been developed by <a href="http://www.3ev.com/">3rd Eye Vision (3ev)</a> is using Akelos. </p>
<p>The <a href="http://www.akelos.org/">Akelos.org</a> site is running a <span class="caps">CMS</span> named Editam which we will release as Open Source in a near future.</p>
<p>Some small websites like <a href="http://www.fundaciocaixacarlet.com/">Fundacio Caixa Carlet</a> and many intranet/extranet sites that we&#8217;ve been coding during the last 2 years.</p>
<h4><em>What are your future plans for Akelos? Anything new on the way?</em></h4>
<p>A new manual, and a better <span class="caps">API</span> interface are the main priorities right now.</p>
<p>Continuing bringing Rails functionality as needed.</p>
<p>Releasing our sister project Editam <span class="caps">CMS</span> which will help developers who need to add functionality on the top of a <span class="caps">CMS</span> using a solid <span class="caps">MVC</span> framework like Akelos.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2006-08-01:/articles/38/</id>
    <title>Akelos is real, after all...</title>
    <published>2006-08-01T23:33:00Z</published>
    <updated>2009-09-06T18:10:53Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/38/"/>
    <category term="frameworks" scheme="http://www.h3rald.com/tags/frameworks/"/>
    <category term="php" scheme="http://www.h3rald.com/tags/php/"/>
    <category term="webdevelopment" scheme="http://www.h3rald.com/tags/webdevelopment/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <content type="html">
<![CDATA[
<p>Bermi Ferrer kept his promise, and even if a few were skeptic on the <a href="http://base--/blog/view/34/">pre-announced</a> features of his upcoming Akelos framework, last week he sent me a &#8220;development preview&#8221; and a few days ago he opened the development <span class="caps">SVN</span> repository to the public:</p>
<p><a href="svn://akelos.org/trunk" target="_blank">svn://akelos.org/trunk</a></p>
<p>Go, get it: it&#8217;s worthwhile (see below).</p>
<p>&#8220;[&#8230;] The Akelos Framework is an open-source port of Ruby on Rails to the <span class="caps">PHP</span> programming language.<br />
The main goal of the Akelos Framework is to help programmers to build multilingual database-backed web applications according to the Model-View-Control pattern. It lets you write less code by favoring conventions over configuration.&#8221;</p>
<p>At the Akelos Framework Features page you can find detailed information about what has been already implemented into the framework.</p>
</blockquote>
<p>I think it says it all, well almost. Some people will undoubtedly be disgusted by yet-another-hopeless-Rails-clone: <em>not again!</em> I hear them crying&#8230;</p>
<p>Well, yeah, I think this &#8211; to be honest &#8211; should be the last attempt someone makes to port Rails to <span class="caps">PHP</span> or at least port <em>some features and the overall philosophy</em>, like <a href="http://base--/bookmarks/view/cakephp">CakePHP</a> did: there are honestly too many for one single language. Look at Python, <a href="http://www.djangoproject.com/">Django</a> seems to be the only &#8220;Rails-inspired&#8221; framework available and everyone is happy with it, while as a general rule <span class="caps">PHP</span> folks are never happy with what they already got.</p>
<p>Bermi is undoubtedly one of them, and that&#8217;s the reason he decided to code his very own Rails-inspired framework for <span class="caps">PHP</span>, which is, to date, the most remarkable of the ones I left out (it wasn&#8217;t available at the time) in my <a href="http://base--/articles/rails-inspired-php-frameworks/">article</a>.</p>
<h3>Confirmed Features &amp; Contents</h3>
<p>So well, although I didn&#8217;t really have a proper chance to play with Akelos I can certainly herald some of its &#8211; verified, this time &#8211; features.</p>
<p>For one, it&#8217;s huge. Take Cake, add <em>every excellent, useful third party library or class you can possibly thing of</em> and you&#8217;ll get Akelos. No kidding. The unzipped source of the whole framework is a massive 16MB, 8.5 of which constitute the <code>vendors</code> folder. What&#8217;s in it? Well, all this:</p>
<ul>
	<li>ADOdb</li>
	<li>Domit</li>
	<li><span class="caps">FPDF</span></li>
	<li>Excel (reader library)</li>
	<li>Hyper Estraier full-text search system</li>
	<li>Inutio <span class="caps">XML</span>-<span class="caps">RPC</span> Library</li>
	<li><em>Many</em> <span class="caps">PEAR</span> packages</li>
	<li>PHPCodeAnalyzer</li>
	<li>PHPmailer</li>
	<li>SimpleTest</li>
	<li>A Simple <span class="caps">PHP</span> <span class="caps">YAML</span> Class</li>
	<li>Textile</li>
</ul>
<p>Then, similarly, all the state-of-the-art Javascript/<span class="caps">AJAX</span> hyper-hyped libraries are included:</p>
<ul>
	<li><span class="caps">AFLAX</span></li>
	<li>Behaviour</li>
	<li>Builder</li>
	<li>various Scriptaculous packages</li>
	<li>Prototype</li>
	<li>FileUploader (by the author, using prototype)</li>
	<li>Window</li>
	<li>EventSelectors</li>
</ul>
<p style="float:left;"><img src="http://base--/img/pictures/frameworks/akelos_framework_logo.gif" alt="" /></p>
<p>Good, well, kind of: that&#8217;s just what <em>others</em> did, but it&#8217;s worth noting that it&#8217;s all there and &#8211; apparently &#8211; integrated with the framework, hopefully not too tightly. But people are fussy, and do not get excited easily anymore, long gone are the early days of Rails, when the whole Internet shake at hearing about <em>code generators</em>&#8230; Aye, there are in Akelos as well, of course!</p>
<p>Coming to the more juicy stuff, <em>lo&#8217; and behold, ye contents of /lib folder (with comments):</em></p>
<ul>
	<li>AkActionController (controller)</li>
	<li>AkActionView (view)</li>
	<li>AkActionWebservice (Web services)</li>
	<li>AkActiveRecord (model)</li>
	<li>AkAdodbCache (content caching)</li>
	<li>AkCharset (utf8 support, includes <em>all</em> mappings)</li>
	<li>AkConfig (load config settings)</li>
	<li>AkConverters (conversions!)
	<ul>
		<li>DBDesigner &gt; AkelosDatabaseDesign</li>
		<li>Excel &gt; Array (bi-dimensional)</li>
		<li>Excel &gt; <span class="caps">CSV</span></li>
		<li><span class="caps">HTML</span> &gt; <span class="caps">RTF</span></li>
		<li><span class="caps">HTML</span> &gt; Text</li>
		<li>Word &gt; Unicode</li>
		<li><span class="caps">PDF</span> &gt; Text</li>
		<li>Xdoc &gt; Text</li>
	</ul></li>
	<li>AkHeaders (<span class="caps">HTTP</span> headers, redirections)</li>
	<li>AkImages (Image operations, resizing)</li>
	<li>AkLocalize (Localization, countries and timezones)</li>
	<li>AkInflector</li>
	<li>AkLogger</li>
	<li>AkFtp</li>
	<li>AkInstaller</li>
	<li>AkRouter</li>
	<li>AkZip</li>
	<li>&#8230;</li>
</ul>
<p>Well, it&#8217;s all there, at any rate. The best way to know if it all works, and <em>how</em> it works, is simply to try it out: <a href="http://www.akelos.org/">www.akelos.org</a>.</p>
<h3>Remarks</h3>
<p>As I said earlier, Akelos looks like <em>CakePHP on steroids</em>: agreed, the Cake philosophy of &#8220;no we-may-use-it code in the trunk&#8221; has been <em>completely</em> (and intentionally) ignored, but this is our chance to peek at what CakePHP could have become if such philosophy didn&#8217;t become a lifestyle for the Cake Dev Team. <br />
Akelos code is Rails-inspired, so yes, it&#8217;s <em>very</em> similar to Cake, although with some rough edges and some re-used parts, but it&#8217;s the work of <span class="caps">ONE</span> person with no community support (yet), don&#8217;t forget. Remarkable.</p>
<p>And he needs co-developers, by the looks of it, so there you are then: there&#8217;s <em>your</em> chance!</p>
<p>My personal opinion about it? Well, I think Akelos can learn from CakePHP and vice-versa: a merge? Well, at least it would reduce the number of Rails-inspired framework for <span class="caps">PHP</span> and <em>possibly</em> meet the needs of more people: those who want just the essentials, as a framework, and those who like to be <em>virtually almighty</em> and be able to do anything, <em>if they wanted to</em>.</p>
<p>Two flavours of the same framework? <em>CakePHP</em> and <em>cAkePHP</em> (note the case)? Bah, let&#8217;s stop raving now, shall we?</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2006-06-10:/articles/34/</id>
    <title>Akelos Framework: too good to be true?</title>
    <published>2006-06-10T09:26:00Z</published>
    <updated>2009-09-06T18:10:52Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/34/"/>
    <category term="frameworks" scheme="http://www.h3rald.com/tags/frameworks/"/>
    <category term="php" scheme="http://www.h3rald.com/tags/php/"/>
    <category term="web-development" scheme="http://www.h3rald.com/tags/web-development/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <content type="html">
<![CDATA[
<p>Someone recently added a comment to my article about <a href="http://base--/articles/rails-inspired-php-frameworks/">Rails-inspired <span class="caps">PHP</span> frameworks</a> pointing out that I forgot another Rails-like framework, in my round-up. He obviously posted a link to this rather mysterious Rails port in <span class="caps">PHP</span> and spam or not, I&#8217;d like to thank this guy for letting me know of the existance of <a href="http://base--/bookmarks/view/akelos-framework">Akelos</a>, a new <span class="caps">PHP</span> framework which seems simply too good to be true.</p>
<p style="float:left;"><img src="http://base--/img/pictures/frameworks/akelos_framework.png" alt="" /></p>
<p>Let me just spend a few words more before writing more about it though. First off, it&#8217;s not available yet. OR at least it doesn&#8217;t seem to be: the author is planning to release his work to the Open Source community but&#8230; well, he&#8217;s a bit concerned about the current &#8220;<span class="caps">PHP</span> Framework War&#8221;: he wouldn&#8217;t like to end up like <a href="http://subway.python-hosting.com/">Subway</a> or just be slagged off by those merciless reviewers who enjoy write round-ups and comparisons about frameworks. <a href="http://www.bermi.org/page/about_me">Bermi Ferrer</a> is &#8220;just&#8221; a talented <span class="caps">PHP</span> developer who decided to create his own framework and he really enjoyed doing so, nothing more, nothing less.</p>
<p><em>&#8220;I considered other <span class="caps">PHP</span> ports of Ruby on Rails, but we could not find all we needed on them. One feature that I needed on the core was internationalization and Unicode support, so I decided to roll my own framework trying to keep most of the original rails interface so most of its documentation could work for it.&#8221;</em></p>
<p>Where did I hear that? Nothing new: it&#8217;s always the same story of frameworks not being as we want them to be etc., it&#8217;s human. And yes, it&#8217;s <em><strong>another</strong></em> attempt to port Ruby on Rails to <span class="caps">PHP</span>, and a damn good one &#8212; or so it seems.</p>
<p><small>Before proceeding any further, I&#8217;d like to write a short warning for a few people who may or may not want to pop in and start commenting about the Rails-is-better-than-any-<span class="caps">PHP</span>-clone issue: <strong>If I see a single comment slagging off this framework (or any other) only because it&#8217;s a port of Rails to <span class="caps">PHP</span>, it will be deleted, may it be David Heinemeier Hansson himself</strong>. Stop it, no seriously, I think it will be counter productive for Rails in the end: I really like RoR and I love the way it works, and yes, I think Ruby is definitely the best language to do that sort of things, <span class="caps">EVERYBODY</span> <span class="caps">KNOWS</span> <span class="caps">THAT</span>. Please, please, save us poor <span class="caps">PHP</span> developers the usual preaching.</small></p>
<p style="float:right;"><img src="http://base--/img/pictures/frameworks/bermi_ferrer.png" alt="" /></p>
<p>Right, back to Akelos now. Curious as I am I immediately checked out the official page and all i found was a pretty long list of features which made me dribble, literally&#8230; ooops!</p>
<p>Let&#8217;s just quote the most juicy ones, shall we?</p>
<p>Active Record [&#8220;Model&#8221;]</p>
<ul>
	<li>Associations</li>
	<li>Callbacks</li>
	<li><strong>Transactions</strong></li>
	<li><strong>Finders</strong> [ <code>$Project-&gt;findFirstBy('language AND start_year:greater', 'PHP', '2004');</code> ]</li>
	<li>Versioning</li>
	<li>&#8230;</li>
</ul>
<p>Action Controller [&#8220;Controller&#8221;]</p>
<ul>
	<li>Filters</li>
	<li>Pagination</li>
	<li>Mime Type</li>
	<li>Mime Response</li>
	<li><strong>Code Generation</strong></li>
	<li>Response handler</li>
	<li>&#8230;</li>
</ul>
<p>Action View [&#8220;View&#8221;]</p>
<ul>
	<li><strong>Templates (using Sintags)</strong></li>
	<li>Web 2.0 javascript using prototype and script.aculo.us</li>
	<li>Helpers</li>
	<li>Partials</li>
	<li><strong>Template Compilers</strong></li>
	<li>&#8230;</li>
</ul>
<p>And then more Akelos-only goodies:</p>
<ul>
	<li><strong>Multilingual Models and Views</strong></li>
	<li><strong>Locale alias integrated on <span class="caps">URLS</span> (example.com/spanish will load the es_ES locale)</strong></li>
	<li>Database migrations using DB Designer files</li>
	<li><strong>Pure <span class="caps">PHP</span> support for Unicode (no extensions required)</strong></li>
	<li><strong>Unit Tested source code</strong></li>
	<li>Code Generators</li>
	<li>Built in <span class="caps">XHTML</span> validator</li>
	<li>Automated locale management</li>
	<li><strong>Clean separation from <span class="caps">HTML</span> and Javascript using <span class="caps">CSS</span> event selectors.</strong></li>
	<li>Ajax file uploads</li>
	<li><strong><span class="caps">AFLAX</span> integration</strong></li>
	<li>Dojo Rich Text Editor</li>
	<li>Format converters</li>
	<li>File handling using <span class="caps">SFTP</span> for shared host running Apache as user nobody (as most CPanel server do)</li>
	<li><strong>Distributed sessions using databases</strong></li>
</ul>
<p>Impressed? I was, honest. And I&#8217;m talking as a CakePHP fanatic here, and I must say that if this framework can really offer all this <em>and</em> &#8212; and this is what really matters &#8212; is also as simple as Cake to learn and well performing&#8230; well, this is definitely going to be quite a promising player in the &#8220;<span class="caps">PHP</span> Framework War&#8221; (but is not a real war, is it?), although the author is quite worried about that:</p>
<p><em>&#8220;I&#8217;m also concerned about the <span class="caps">PHP</span> Framework war, I don&#8217;t want to play that game. Building this Framework was a great experience, it works great for me and it has helped me to become a better programmer so I don&#8217;t want to spend my time discussing about if this is better or not than other solutions. That&#8217;s the reason I&#8217;ll first look for great developers interested in the Framework to help me releasing it.&#8221;</em></p>
<p>Really, this will be an interesting project to check out, once it goes open source, and yes, I really wish Bermi all the best. Good luck, <a href="http://www.bermi.org/projects/akelos_framework">Akelos Framework</a>.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2006-05-06:/articles/26/</id>
    <title>bake.php - Easy baking for lazy folks</title>
    <published>2006-05-06T13:43:00Z</published>
    <updated>2009-09-06T18:10:51Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/26/"/>
    <category term="cakephp" scheme="http://www.h3rald.com/tags/cakephp/"/>
    <category term="frameworks" scheme="http://www.h3rald.com/tags/frameworks/"/>
    <content type="html">
<![CDATA[
<p>When I first tried Ruby on Rails I was literally amazed by the <em>generator</em> script. Yes, I was young and inexperienced then (six/seven months ago), but you must admit that getting a controller, a model, all the basic views generated automatically by</p>
<p><code>rails script/generator scaffold Posts</code></p>
<p>is not a bad thing. Especially if the same script allows you to create model, views and controller separately and other things. <a href="http://www.symfony-project.com/">Symfony</a> and <span class="caps">PHP</span> on Trax already tried to port this functionalities, with mixed results. What about Cake? Oh well, yes, we do have something like that&#8230; something rather different, but still something: the <code>bake.php</code> script.<br />
This cute little thing is located in the <code>cake/scripts/</code> folder and can be used &#8211; hear, hear &#8211; from command line. You can run Ruby and Perl scripts, so yes, you can actually run <span class="caps">PHP</span> from command line, although it&#8217;s not its primary purpose.</p>
<p><img src="http://base--/img/pictures/bake.jpg" alt="" /></p>
<p>Cool then, let&#8217;s open a *nix shell, Windows command prompt, etc. etc., go into the <code>cake/scripts/</code> folder and run:</p>
<p><code>php bake.php</code></p>
<p>Assuming that the php executable is in your <em><span class="caps">PATH</span></em> environment variable &#8211; if not, either you add it or you&#8217;ll have to type something like:</p>
<p><code>D:SERVERphpphp.exe bake.php</code></p>
<p>depending on where your php executable is. You&#8217;ll be be greeted by a &#8220;<span class="caps">CAKEPHP</span> <span class="caps">BAKE</span>&#8221; text, and then you&#8217;ll be asked a few questions. One thing to realize before proceeding any further: bake.php is <em>not</em> a generator, not in the traditional &#8220;Rails&#8221; sense, anyway. It&#8217;s rather a handy but more verbose dialogue-based configuration script &#8211; which will also generate <em>something</em> eventually if you provide all the necessary details.<br />
A different approach, which may be good or bad according to your taste: personally I think we should also have something faster to use, like a Rails generator, and I opened a <a href="https://trac.cakephp.org/ticket/768">ticket</a> about it, but let&#8217;s see what bake.php can do, for now.</p>
<p>The answer is&#8230; nearly anything. It annoying enough to please, but if you follow its directions it can do a prettu decent job in the end, it&#8217;s far from being sentient, but let&#8217;s say it&#8217;s smart enough for a script. First of all if you try it out on a fresh Cake install it will notice that you haven&#8217;t configured your database yet, so it will ask for a hostname, username, password, database name etc. etc. and generate your <code>app/config/database.php</code> for you, not a bad start.</p>
<p>Once that&#8217;s done &#8211; and it won&#8217;t go on unless you configure a (MySQL only?) database &#8211; you can proceed with the rest. You can start creating either a controller, model or view; I tried a <code>Posts</code> controller, for example. The script then asks quite a few questions:</p>
<ul>
	<li>The controller&#8217;s name</li>
	<li>Whether it will use other models besides posts</li>
	<li>Whether you want to include any helper</li>
	<li>Whether you want to include any component</li>
	<li>Whether you want to generate the base <span class="caps">CRUD</span> methods</li>
</ul>
<p>Then finally it generates the damn thing. The result is good enough:</p>
<p><small><br />
<pre><code>
&lt;?php
class PostsController extends AppController
{
	//var $scaffold;
	var $name       = 'Posts';</p>
<p>function index()<br />
	{<br />
		$this&#8594;set(&#8216;data&#8217;, $this&#8594;Post&#8594;findAll());<br />
	}</p>
<p>function add()<br />
	{<br />
		if(empty($this&#8594;params[&#8216;data&#8217;]))<br />
		{<br />
			$this&#8594;render();<br />
		}<br />
		else<br />
		{<br />
			if($this&#8594;Post&#8594;save($this&#8594;params[&#8216;data&#8217;]))<br />
			{<br />
				$this&#8594;flash(&#8216;Post saved.&#8217;, &#8216;/posts/index&#8217;);<br />
			}<br />
			else<br />
			{<br />
				$this&#8594;render();<br />
			}<br />
		}<br />
	}</p>
<p>function edit($id)<br />
	{<br />
		if(empty($this&#8594;params[&#8216;data&#8217;]))<br />
		{<br />
			$this&#8594;set(&#8216;data&#8217;, $this&#8594;Post&#8594;find(&#8216;Post.id = &#8217; . $id));<br />
		}<br />
		else<br />
		{<br />
			if($this&#8594;Post&#8594;save($this&#8594;params[&#8217;data&#8217;]))<br />
			{<br />
				$this&#8594;flash(&#8216;Post saved.&#8217;, &#8216;/posts/index&#8217;);<br />
			}<br />
			else<br />
			{<br />
				$this&#8594;set(&#8216;data&#8217;, $this&#8594;params[&#8216;data&#8217;]);<br />
				$this&#8594;validateErrors($this&#8594;Post);<br />
				$this&#8594;render();<br />
			}<br />
		}<br />
	}</p>
<p>function view($id)<br />
	{<br />
		$this&#8594;set(&#8216;data&#8217;, $this&#8594;Post&#8594;find(&#8217;Post.id = &#8217; . $id));<br />
	}</p>
<p>function delete($id)<br />
	{<br />
		$this&#8594;Post&#8594;del($id);<br />
		$this&#8594;redirect(&#8216;/posts/index&#8217;);<br />
	}</p>
<p>function postList()<br />
	{<br />
		$vars = $this&#8594;Post&#8594;findAll();<br />
		foreach($vars as $var)<br />
		{<br />
			$list[$var[&#8216;Post&#8217;][&#8216;id&#8217;]] = $var[&#8216;Post&#8217;][&#8216;name&#8217;];<br />
		}</p>
<p>return $list;<br />
	}<br />
}<br />
?&gt;<br />
</code></pre><br />
</small></p>
<p>It&#8217;s more or less the same with models and views: it will still ask a lot of questions and in the end generate the thing. <br />
This behaviour is more advanced than a standard generator, you can include helpers and components already, if you want, but do you <em>really</em> want that? For models it even asks if you want to include particular associations and validation rules! Personally, I&#8217;d rather a generator script which generates something <em>immediately</em> and accepts maybe some parameters to further customization, like:</p>
<p><code>php bake.php scaffold Posts</code><br />
<code>php bake.php controller Posts</code><br />
<code>php bake.php model Posts</code><br />
<code>php bake.php model Posts</code><br />
<code>php bake.php controller Posts helper +Html -Time,Javascript</code><br />
<code>php bake.php model Posts assoc +hasMany comments,tags</code></p>
<p>Bah&#8230; just some random thoughts. How about custom-made generators (<a href="http://wiki.rubyonrails.org/rails/pages/AvailableGenerators">Rails-inspired</a>)?</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2006-05-03:/articles/rails-inspired-php-frameworks/</id>
    <title>Rails-inspired PHP frameworks</title>
    <published>2006-05-03T12:57:00Z</published>
    <updated>2010-09-23T11:56:33Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/rails-inspired-php-frameworks/"/>
    <category term="frameworks" scheme="http://www.h3rald.com/tags/frameworks/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="cakephp" scheme="http://www.h3rald.com/tags/cakephp/"/>
    <category term="rails" scheme="http://www.h3rald.com/tags/rails/"/>
    <content type="html">
<![CDATA[
<p>There are various articles online examining many <span class="caps">PHP</span> frameworks, providing short reviews or comparative charts, but I could not find yet an article  examining the so called <em>&#8220;Rails-inspired frameworks&#8221;</em> anywhere on the web, so I decided to write my own&#8230;</p>
<blockquote>
<p><strong><span class="caps">IMPORTANT</span> <span class="caps">UPDATE</span>:</strong> I do no longer recommend the CakePHP framework anymore due to the <a href="http://www.h3rald.com/blog/42">unprofessionalism of some member of its development team</a>. My site is now powered by Ruby on Rails and I totally lost interest in <span class="caps">PHP</span> and any <span class="caps">PHP</span> framework. If you are looking for a decent web framework, try <a href="http://www.rubyonrails.org">Ruby on Rails</a> (for Ruby), <a href="http://www.djangoproject.com/">Django</a> (for Python) or <a href="http://catalyst.perl.org/">Catalyst</a> (for Perl).<br />
I&#8217;m talking about those <span class="caps">PHP</span> frameworks who give at least part of their success to Ruby on Rails<sup class="footnote" id="fnr2"><a href="#fn2">2</a></sup>, but don&#8217;t call them <em>clones</em> or <em>ports</em> as some of their creators may get offended.</p>
</blockquote>
<p style="float:left;"><img src="/img/pictures/rails.gif" alt="" /></p>
<p>Since Rails shocked the world with an easy-to-use, powerful and semi-sentient web development framework, web development is not the same anymore: everything must be done efficiently, quickly and you <em>have</em> to produce a Web 2.0 compliant public beta after X days/weeks/months or your work is simply not useful to anybody. Try doing that with the traditional <span class="caps">PHP</span> spaghetti code: you can&#8217;t, it&#8217;s too much, it will be too tangled up and in the end you&#8217;ll lose your mind trying to find that <em>small insignificant bug</em> which makes your web application completely useless.</p>
<p>Yes, you could use Rails, but maybe you don&#8217;t know or don&#8217;t want to learn Ruby, your host doesn&#8217;t support it, your boss loves <span class="caps">PHP</span> etc. etc. If you&#8217;re in this situation or you simply would like to know what&#8217;s going on at the <span class="caps">PHP</span> front of the Rails Clone War, you should keep reading this article.</p>
<p>I&#8217;d like to introduce &#8211; briefly &#8211; six Rails-inspired <span class="caps">PHP</span> frameworks and compare them with each other, to point out their features, their pros and cons.</p>
<blockquote>
<p><em><strong>Disclaimer:</strong> I&#8217;m a CakePHP<sup class="footnote" id="fnr3"><a href="#fn3">3</a></sup> fan, this site has been built with CakePHP and I even wrote something<sup class="footnote" id="fnr4"><a href="#fn4">4</a></sup> about it in the past. This makes me inevitably partial and more familiar with this particular framework, but I&#8217;ll try my very best to provide a relatively objective analysis. Obviously frameworks which are not based on the <span class="caps">MVC</span> architechture and that weren&#8217;t inspired by Ruby on Rails have not been included, so forget things like <span class="caps">PRADO</span>, Qcodo, eZComponents, or even Mojavi: it&#8217;s not that they are &#8220;bad&#8221;, they&#8217;ve just been left out because they are not pertinent to this article</em></p>
</blockquote>
<h3>CakePHP</h3>
<p style="float:right;"><img src="/img/pictures/CakePHP_1.0.png" alt="" /></p>
<p><strong>Website:</strong> <a href="http://www.cakephp.org/">www.cakephp.org</a><br />
<strong><span class="caps">PHP</span> version:</strong> PHP4 and PHP5<br />
<strong>License:</strong> <span class="caps">MIT</span><sup class="footnote" id="fnr5"><a href="#fn5">5</a></sup><br />
<strong>Download size (.tar.gz):</strong> 184KB<br />
<strong>Supported Databases:</strong> MySQL, PostgreSQL, SQlite, MS <span class="caps">SQL</span> + any other supported by ADOdb or <span class="caps">PEAR</span>::DB database abstraction layers<br />
<strong>Beginner&#8217;s Tutorial</strong>: <a href="http://wiki.cakephp.org/tutorials:blog_tutorial_-_1">Blog Tutorial</a></p>
<p><strong>Official Description:</strong><br />
<em>&#8220;Cake is a rapid development framework for <span class="caps">PHP</span> which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and <span class="caps">MVC</span>. Our primary goal is to provide a structured framework that enables <span class="caps">PHP</span> users at all levels to rapidly develop robust web applications, without any loss to flexibility.&#8221;</em></p>
<p><strong>PROs:</strong></p>
<ul>
	<li>Lightweight, not bloated, containing only essential code</li>
	<li>Runs both on PHP4 and PHP5</li>
	<li>No configuration needed &#8211; except for a stupidly short database configuration file and a few constants which <em>can</em> be modified. You can literally start baking in less than five minutes</li>
	<li>Extended table association support, allowing the creation of complex database architechtures</li>
	<li>Extremely logical and functional directory structure: better than Rails, if you ask me.</li>
	<li>Enhanced <span class="caps">AJAX</span> support through the <span class="caps">AJAX</span> and Javascript view helpers</li>
	<li>useful &#8220;bake&#8221; command line script to generate parts of the  code automatically</li>
	<li>Very active community and plenty of <em>satellite sites</em></li>
	<li>Suitable for every kind of website, from the small personal site to the advanced e-business application.</li>
</ul>
<p><strong>CONs:</strong></p>
<ul>
	<li>No &#8220;official&#8221; internationalization support for now, but it will be included in the next milestone.</li>
	<li>It does not take fully advantage of PHP5 features</li>
	<li>Official documentation still needs some some improvement, although now it seems pretty complete and exhaustive.</li>
</ul>
<p><strong>Comments:</strong><br />
CakePHP is my personal favorite: easy to learn, easy to use,multi-purpose and not bloated. Cake&#8217;s philosophy is not to include unnecessary code in the framework unless it&#8217;s absolutely necessary for the framework itself, as a result, 3rd-party libraries are not included in the official releases, but may be seamlessly integrated with the framework <em>if developers need them</em>. <br />
Cake&#8217;s success is partly determined &#8211; at least initially &#8211; by the fact that it can run fine with no limitations on PHP4, while other similar frameworks don&#8217;t. Although this may still be one of its most obvious strengths, it must be said that Cake seems to go in the right direction, taking only the best from Rails, without forcing developers into complex and pointless adaptations, and evolving into a great framework created <em>in <span class="caps">PHP</span>, for <span class="caps">PHP</span></em>.</p>
<h3>Symfony</h3>
<p style="float:right;"><img src="/img/pictures/symfony.gif" alt="" /></p>
<p><strong>Website:</strong> <a href="http://www.symfony-project.com/">www.synfony.project.com</a><br />
<strong><span class="caps">PHP</span> version:</strong> PHP5<br />
<strong>License:</strong> Symfony<sup class="footnote" id="fnr6"><a href="#fn6">6</a></sup><br />
<strong>Download size (.tgz):</strong> 1255KB<br />
<strong>Supported Databases:</strong> MySQL, PostgreSQL, SQLite, Oracle, MS <span class="caps">SQL</span> + any other supported by Creole database abstraction layer<br />
<strong>Beginner&#8217;s Tutorial</strong>: <a href="http://www.symfony-project.com/tutorial/my_first_project.html">My first project</a></p>
<p><strong>Official Description:</strong><br />
<em>&#8220;Based on the best practices of web development, thoroughly tried on several active websites, symfony aims to speed up the creation and maintenance of web applications, and to replace the repetitive coding tasks by power, control and pleasure. [&#8230;]</em><br />
<em>Symfony is an object-oriented PHP5 framework based on the <span class="caps">MVC</span> model. Symfony allows for the separation of business rules, server logic and presentation views of a web application. It also contains numerous tools and classes aimed at shortening the development time of a complex web application.&quot;</em></p>
<p><strong>PROs:</strong></p>
<ul>
	<li>Fully featured framework, includes everything you might ever need (see CONs, below)</li>
	<li>Full native internationalization support</li>
	<li>Truly excellent documentation, tutorials, wiki, book, screencasts, <span class="caps">API</span>, real-world examples, etc. etc.</li>
	<li>Code generators</li>
	<li>Various &#8220;pre-built&#8221; modules/libraries for the most common tasks</li>
	<li>It was not inspired only by Rails, but borrows concepts and practices from various other frameworks</li>
	<li>Good community support</li>
</ul>
<p><strong>CONs:</strong></p>
<ul>
	<li>Seems too big compared to the others, too many &#8220;extras&#8221; which may not be useful to <em>all</em> developers</li>
	<li>PHP5 only</li>
	<li>Confusing and disorganized directory structure</li>
	<li>Uses too many configuration files, not suitable for <em>simple</em> projects</li>
	<li>Steep learning curve</li>
</ul>
<p><strong>Comments:</strong><br />
Symfony is really an interesting framework: it&#8217;s perhaps the most <em>complete</em> in terms for features and documentation. The only problem I have with it is that it just seems too complex and rather difficult to learn if compared to the others, which can do <em>almost</em> the same things (or will soon be able to) in a <em><span class="caps">MUCH</span></em> simpler way. A nice blend of <span class="caps">MVC</span>, pre-built components, command line generators and <span class="caps">YAML</span>/Propel configuration files, but perhaps a bit <em>disorganized</em> in its internal structure, unlike its wonderful documentation and support section.</p>
<h3><span class="caps">PHP</span> on Trax</h3>
<p style="float:right;"><img src="/img/pictures/phpontrax.jpg" alt="" /></p>
<p><strong>Website:</strong> <a href="http://www.phpontrax.com/">www.phpontrax.com</a><br />
<strong><span class="caps">PHP</span> version:</strong> PHP5<br />
<strong>License:</strong> <span class="caps">MIT</span><br />
<strong>Download size (.tgz):</strong> 843KB<br />
<strong>Supported Databases:</strong> Any database supported by <span class="caps">PEAR</span>::DB<br />
<strong>Beginner&#8217;s Tutorial</strong>: <a href="http://svn.phpontrax.com/wiki/HowToCreateATraxApplication">How to create a Trax application</a></p>
<p><strong>Official Description:</strong><br />
<em>&#8220;Php On Trax (formerly Php On Rails) is a web-application and persistance framework that is based on Ruby on Rails and includes everything needed to create database-backed web-applications according to the Model-View-Control pattern of separation.&#8221;</em></p>
<p><strong>PROs:</strong></p>
<ul>
	<li>Simple, logical, essential: a true RoR port to PHP5</li>
	<li>Code generators, like Rails</li>
	<li>Zero configuration (like Rails and Cake</li>
	<li>Easy and logical directory structure (the same as Rails)</li>
	<li>Supports table associations, but more in a way which is more similar to Ruby on Rails than Cake.</li>
</ul>
<p><strong>CONs:</strong></p>
<ul>
	<li>Lack of documentation compared to the others</li>
	<li>Trying to port Ruby on Rails to <span class="caps">PHP</span>, ignoring why RoR was not built in <span class="caps">PHP</span> in the first place<sup class="footnote" id="fnr7"><a href="#fn7">7</a></sup></li>
	<li>No internationalization or other advanced functionalities</li>
	<li>PHP5 only</li>
	<li>Small community</li>
	<li><span class="caps">DBO</span> class based only on <span class="caps">PEAR</span>::DB</li>
</ul>
<p><strong>Comments:</strong><br />
In my opinion this project aims too much to be a Rails-clone to acquire a proper consensus. Trying to port something to another language is not good, especially in the case of Rails and Ruby. This framework looks somehow like an old version of CakePHP, which evolved slightly but always remained anchored to its beliefs of building a Rails port for <span class="caps">PHP</span> (even in the name!). Some may say that this is a lost battle since the beginning &#8211; or better, since before it started &#8211; but others found that <span class="caps">PHP</span> on Trax can be the easiest way to switch from Ruby on Rails to a <span class="caps">PHP</span> equivalent. Who is going to do that? Well, Ruby programmers <em>forced</em> to develop in <span class="caps">PHP</span>, maybe. Not too good, but not too bad either.</p>
<h3>Code Igniter</h3>
<p style="float:right;"><img src="/img/pictures/codeigniter.jpg" alt="" /></p>
<p><strong>Website:</strong> <a href="http://www.codeigniter.com/">www.codeigniter.org</a><br />
<strong><span class="caps">PHP</span> version:</strong> PHP4 and PHP5<br />
<strong>License:</strong> CodeIgniter<sup class="footnote" id="fnr8"><a href="#fn8">8</a></sup><br />
<strong>Download size (.zip):</strong> 609KB<br />
<strong>Supported Databases:</strong> MySQL, PostgreSQL, SQLite, MySQLi, MS <span class="caps">SQL</span> + <span class="caps">ODBC</span><br />
<strong>Beginner&#8217;s Tutorial</strong>: <a href="http://www.codeigniter.com/videos/ci_intro.mov">Hello World! Introduction to Code Igniter</a> [video]</p>
<p><strong>Official Description:</strong><br />
<em>&#8220;Code Igniter is an Open Source Web Application Framework that makes writing kick-ass <span class="caps">PHP</span> programs simple as apple pie. [&#8230;] Designed to enable, not overwhelm, Code Igniter is a powerful <span class="caps">PHP</span> framework with a very small footprint, built for <span class="caps">PHP</span> coders who need a simple and elegant toolkit to create full-featured web applications.</em><br />
<em>If you&#8217;re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you&#8217;re tired of ponderously large and thoroughly undocumented frameworks that require rocket science to understand, Code Igniter might just be the right tool for you.&quot;</em></p>
<p><strong>PROs:</strong></p>
<ul>
	<li>Good and organized documentation</li>
	<li>Zero configuration (like Rails and Cake)</li>
	<li>Includes various classes and libraries for common tasks</li>
	<li>Compatible with PHP4 and PHP5</li>
	<li>Medium-sized community</li>
	<li>Intuitive directory structure</li>
	<li>Ships with the full user guide included in separate <span class="caps">HTML</span> files</li>
</ul>
<p><strong>CONs:</strong></p>
<ul>
	<li>No full (&#8220;written&#8221;) tutorials except the videos!</li>
	<li>Relatively new to the scene, but growing</li>
	<li>Does not seem to support table associations.</li>
</ul>
<p><strong>Comments:</strong><br />
People on the Net seem to be rather enthusiastic about this framework: where there&#8217;s a thread about the <em>big ones</em> (Cake and Symfony), there&#8217;s always, someone who pops in suggesting to try out Code Igniter. I personally think this can be a true bless for small/medium sized projects, however, I&#8217;d opt for CakePHP or Symfony for a large scale application: something is missing, e.g., most notably, table associations.</p>
<h3>Biscuit</h3>
<p style="float:right;"><img src="/img/pictures/biscuit.gif" alt="" /></p>
<p><strong>Website:</strong> <a href="http://biscuitproject.tigris.org/">biscuitproject.tigris.org</a><br />
<strong><span class="caps">PHP</span> version:</strong> PHP4 and PHP5<br />
<strong>License:</strong> <span class="caps">MIT</span><sup class="footnote" id="fnr5"><a href="#fn5">5</a></sup>  <br />
<strong>Download size (.zip):</strong> 240KB<br />
<strong>Supported Databases:</strong> Any database supported by <span class="caps">PEAR</span>::DB<br />
<strong>Beginner&#8217;s Tutorial</strong>: <a href="http://bennolan.com/biscuit/tutorial.html">Creating a simple application using the Biscuit <span class="caps">MVC</span> framework</a></p>
<p><strong>Official Description:</strong><br />
<em>&#8220;The mission of this project is to port Ruby on Rails to PHP5 (minus the Ruby part ;-)&#8221;</em></p>
<p><strong>PROs:</strong></p>
<ul>
	<li>Zero configuration, easy to deploy</li>
	<li>Runs both on PHP4 and PHP5</li>
	<li>Simple to learn</li>
</ul>
<p><strong>CONs:</strong></p>
<ul>
	<li>Still under development and incomplete</li>
	<li>Offers a limited subset of the features and functionalities offered by competitors: no internationalization, no table associations, no scaffolding&#8230;</li>
	<li><em>&#8220;Documentation coming soon&#8221;</em></li>
	<li>Almost non-existent community</li>
</ul>
<p><strong>Comments:</strong><br />
This project started as an attempt to create something simpler than CakePHP and more similar to Rails. I&#8217;m not sure whether the project is still active or not, since the last &#8220;release&#8221; on the former&#8217;s developer site is dated August 2005. Still in early stage &#8211; or dead.</p>
<h3>Pipeline</h3>
<p style="float:right;"><img src="/img/pictures/livepipe.jpg" alt="" /></p>
<p><strong>Website:</strong> <a href="http://livepipe.net/pipeline/">livepipe.net/pipeline/</a><br />
<strong><span class="caps">PHP</span> version:</strong> PHP5<br />
<strong>License:</strong> Pipeline<sup class="footnote" id="fnr9"><a href="#fn9">9</a></sup><br />
<strong>Download size (.zip):</strong> 288KB<br />
<strong>Supported Databases:</strong> SQLite<br />
<strong>Beginner&#8217;s Tutorial</strong>: none</p>
<p><strong>PROs:</strong></p>
<ul>
	<li>Simple directory structure</li>
	<li>Suitable for small projects</li>
	<li>Comes with various ready-made components</li>
	<li>Supports table relationships</li>
</ul>
<p><strong>CONs:</strong></p>
<ul>
	<li>PHP5-only</li>
	<li>Too restrictive: only SQLite supported, <em>kindly suggests</em> developers to use its built-in features only</li>
	<li>No documentation or tutorials, just the <span class="caps">API</span></li>
	<li>Not suitable for large projects</li>
	<li>Almost non-existent community</li>
</ul>
<p><strong>Comments:</strong><br />
This project mainly borrowed the <span class="caps">MVC</span> architecture and some basic concepts from Rails, creating a simple PHP5 framework with personal/small websites in mind: it offers various built-in components which can be handy to most of us, supports <em>only</em> SQLite, and basically tells developers what to do. In my opinion it&#8217;s not flexible enough to be compared to the others, and it&#8217;s simply not suitable for anything other than small websites.</p>
<h3>Conclusions</h3>
<p>My favorite framework still remains CakePHP, it&#8217;s simple and yet powerful, easy to learn and use, mature, well supported and continuously improving. Symfony &#8211; at the moment &#8211; seems to be the one with most features and the best documentation, and it is an excellent and well supported project. The only problem I have with it is the scary amount of configuration files necessary to create an application: CakePHP doesn&#8217;t need any and can be used for (almost?) equally complex projects.<br />
Although I didn&#8217;t have a chance to try them out, <span class="caps">PHP</span> on Trax is certainly the most faithful port of Ruby on Rails to <span class="caps">PHP</span>, but it lacks some of the features CakePHP and Symfony offer. Code Igniter may not be as advanced as the others, but its community seems to grow and its simplicity may appeal more users in the future&#8230;</p>
<p>At any rate, developers should <em>always</em> choose the best framework for their needs: I tried to write a quick comparative analysis of these six Rails&#8217; &#8220;<span class="caps">PHP</span> children&#8221;, now it&#8217;s <em>your</em> turn, try out some of them, if you choose wisely you won&#8217;t be disappointed.</p>
<h3>Notes</h3>
<p class="footnote" id="fn1"><a href="#fnr1"><sup>1</sup></a> They are all distributed according to various Open Source licenses.</p>
<p class="footnote" id="fn2"><a href="#fnr2"><sup>2</sup></a> <a href="http://www.rubyonrails.org">Ruby on Rails</a> &#8211; Ruby framework for web development</p>
<p class="footnote" id="fn3"><a href="#fnr3"><sup>3</sup></a> <a href="http://www.cakephp.org">CakePHP</a> &#8211; Rapid [<span class="caps">PHP</span>] Development Framework</p>
<p class="footnote" id="fn4"><a href="#fnr4"><sup>4</sup></a> <a href="/articles/view/cakephp">CakePHP &#8211; A &#8216;tasty&#8217; solution for <span class="caps">PHP</span> programming</a>, originally published on <a href="http://www.zzine.org/articles/cakephp">zZine Magazine</a></p>
<p class="footnote" id="fn5"><a href="#fnr5"><sup>5</sup></a> Open Source <a href="http://www.opensource.org/licenses/mit-license.php"><span class="caps">MIT</span> License</a>.</p>
<p class="footnote" id="fn6"><a href="#fnr6"><sup>6</sup></a> Symfony License:<br />
<small><br />
<blockquote><br />
Copyright &#169; 2004-2006 Fabien Potencier<br />
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &#8220;Software&#8221;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
<p><span class="caps">THE</span> <span class="caps">SOFTWARE</span> IS <span class="caps">PROVIDED</span> &#8220;AS IS&#8221;, <span class="caps">WITHOUT</span> <span class="caps">WARRANTY</span> OF <span class="caps">ANY</span> <span class="caps">KIND</span>, <span class="caps">EXPRESS</span> OR <span class="caps">IMPLIED</span>, <span class="caps">INCLUDING</span> <span class="caps">BUT</span> <span class="caps">NOT</span> <span class="caps">LIMITED</span> TO <span class="caps">THE</span> <span class="caps">WARRANTIES</span> OF <span class="caps">MERCHANTABILITY</span>, <span class="caps">FITNESS</span> <span class="caps">FOR</span> A <span class="caps">PARTICULAR</span> <span class="caps">PURPOSE</span> <span class="caps">AND</span> <span class="caps">NONINFRINGEMENT</span>. IN NO <span class="caps">EVENT</span> <span class="caps">SHALL</span> <span class="caps">THE</span> <span class="caps">AUTHORS</span> OR <span class="caps">COPYRIGHT</span> <span class="caps">HOLDERS</span> BE <span class="caps">LIABLE</span> <span class="caps">FOR</span> <span class="caps">ANY</span> <span class="caps">CLAIM</span>, <span class="caps">DAMAGES</span> OR <span class="caps">OTHER</span> <span class="caps">LIABILITY</span>, <span class="caps">WHETHER</span> IN AN <span class="caps">ACTION</span> OF <span class="caps">CONTRACT</span>, <span class="caps">TORT</span> OR <span class="caps">OTHERWISE</span>, <span class="caps">ARISING</span> <span class="caps">FROM</span>, <span class="caps">OUT</span> OF OR IN <span class="caps">CONNECTION</span> <span class="caps">WITH</span> <span class="caps">THE</span> <span class="caps">SOFTWARE</span> OR <span class="caps">THE</span> <span class="caps">USE</span> OR <span class="caps">OTHER</span> <span class="caps">DEALINGS</span> IN <span class="caps">THE</span> <span class="caps">SOFTWARE</span>.</p>
</blockquote>
<p></small></p>
<p class="footnote" id="fn7"><a href="#fnr7"><sup>7</sup></a> Read the comments by David Heinemeier Hansson on <a href="http://www.37signals.com/svn/archives/000606.php">Ruby on Rails to Basecamp</a></p>
<p class="footnote" id="fn8"><a href="#fnr8"><sup>8</sup></a> CodeIgniter <a href="http://www.codeigniter.com/user_guide/license.html">License Agreement</a></p>
<p class="footnote" id="fn9"><a href="#fnr9"><sup>9</sup></a> Pipeline is licensed under the same terms as the Symfony framework [Copyright &#169; 2006 Picora Pipeworks <span class="caps">LLC</span>].</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2005-12-08:/articles/cakephp/</id>
    <title>CakePHP - A 'tasty' solution for PHP programming</title>
    <published>2005-12-08T16:03:39Z</published>
    <updated>2009-09-06T18:10:49Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/cakephp/"/>
    <category term="cakephp" scheme="http://www.h3rald.com/tags/cakephp/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="frameworks" scheme="http://www.h3rald.com/tags/frameworks/"/>
    <category term="webdevelopment" scheme="http://www.h3rald.com/tags/webdevelopment/"/>
    <content type="html">
<![CDATA[
Web developers can either love or hate PHP, and one of the criticisms of this easy-to-use programming language which is repeated over and over on IRC, forums and blogs is that "PHP is disorganized".<br />
Is this really true? If so, is there any possible way to write a PHP application in a logical and clean way? Read on...Every web developer has certainly heard of PHP. Some people like it and consider it a powerful and easy-to-use way to create complex websites or web applications, while others are convinced that it is merely a bad copy of Perl.  Opinions are certainly mixed on the matter.<br />
<br />
One thing to keep in mind when reading criticisms of PHP is its origins, as therein lies the crux of the matter. PHP was created as a form interpreter, initially offering only a <em>very limited</em> range of functionality.  Its main purpose was to make life easier for web developers who wanted to do simple tasks,  like manipulating form data.<br />
<br />
People liked the concept - PHP was free and it quickly became popular among developers. More functionality was added and continues to be added with each new release, and PHP is now one of the most popular and powerful programming languages available for web development.It is relatively easy to learn, compared to Perl, ASP, or JSP, and it can be used for almost anything[1].<br />
<br />
The sheer simplicity of the language was most likely the cause of the enormous amount of exploits discovered through the years which earned PHP the label "<em>too dangerous to use in 'proper' applications</em>". The danger, however, lies not in the language itself, but rather in the <em>way</em> developers make use of the language: PHP's simplicity makes writing bad or exploitable code extremely easy. Furthermore, PHP's ability to be placed within any HTML page with the greatest of ease tempted developers to write ever-increasing amounts of 'spaghetti code', which by its very nature is neither organized nor clean code, and certainly does not help a developer learn how to write organized or clean code.<br />
<br />
These problems, however, can be solved.  There are many ways to go about doing this, but the easiest, most effective way is to create a framework[2]. <br />
<br />
<br />
<strong>Bringing Order to Chaos</strong><br />
<br />
After learning some PHP myself, I remember noticing that my applications were growing in a disorganized and uncontrollable manner. Things tended to be added at the last minute, and bugs were fixed and patched 'on the fly' wherever they occurred.  PHP lacked the structure that is present in most other programming languages.  I remember reading the word <em>framework</em> for the first time not too long ago while I was downloading a Windows Update of the .NET framework[3].  That inspired me to start searching the Internet for a 'PHP framework'.  That led me to an interesting blog entry[4] where a solution was proposed - a solution to <em>bring order to chaos</em>:<br />
<br />
<fieldset><blockquote><br />
[...] The answer is simple: create our own class library, some kind of framework, the PHP framework. The similar in many ways to that one which is already well known to Java or .NET programmers. We could set the standards, structure and main guidelines. [...]<br />
</blockquote></fieldset><br />
<br />
That blog post made me think about developing my own framework, until I noticed that there were many projects already in progress, and some in fact completed; the end result being a  fully functional PHP framework.  I read a lot about some of them[5], and abandoned the idea of developing my own, because as a good developer, I believe I should never re-invent the wheel. So I kept looking. I found Pear[6], although that's more a repository of PHP classes with a common standard than a framework, while I was looking for THE solution to developing many types of applications, not merely how to do one thing in particular.<br />
<br />
I came across a very promising project named Prado[7], which  won the latest Zend contest, and was considered the best PHP5 application of the year. It is a masterpiece of coding and PHP5 usage, so I tried to learn it.  I even developed a website with it.<br />
<br />
Prado lets the developer design the application without imposing any ready-made components, but I found its event-driven[8] approach neither easy to learn nor suitable for everyday web applications. I did not like the idea of having to code a reaction to every event (like a click on a button or different phases of page rendering): that is the approach that ASP takes, and at least in that respect, Prado seems to be inspired by the .NET framework.  Event-driven programming is suitable for GUI development and desktop-based interfaces, but not for web applications.<br />
<br />
After trying Prado, I was still unsatisfied, so I once again began my search for a solution to improve my programming. My meanderings took me to Ruby on Rails[9], one of the most recent examples of technology hype on the Net.  At the same time,to a  certain extent, it is also a successful tool. <br />
<br />
<br />
<strong>The Rails Phenomenon</strong><br />
<br />
<fieldset><blockquote><br />
"Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups."<br />
</blockquote></fieldset><br />
<br />
That sounded like what I was looking for, and  I started reading more about it in the vast and varied help sections[10] available both on and off of the official site. The Rails team did an outstanding job promoting and marketing the framework, and also in providing comprehensive textual documentation (and even video tutorials) to help both beginners as well as experienced programmers get started with it.<br />
<br />
Briefly, Rails uses Ruby's object oriented programming, in conjunction with the MVC pattern and various automated scripts (generators), to help developers program their applications quickly and in a solid and organized way.  However, as that is neither clear nor convincing, let's spend a few moments on the MVC Pattern[11], which will also be useful to understanding the following sections.<br />
<br />
MVC stands for <strong>M</strong>odel <strong>V</strong>iew <strong>C</strong>ontroller: these three words enclose - and this is just a personal opinion - all the wisdom and philosophy of web development, describing - once again, in my opinion - the three most logical parts a web application <em>should</em> be divided into to achieve code robustness, order and power, all at the same time.  Let's look at what each of the component parts mean in detail:<br />
<br />
<ul><br />
[*]<strong>Model</strong>: The model represents the very essence of the <em>information</em> and <em>content</em> of a web application. Imagine this as an object able to gather the information and content of your webpages from a particular resource, such as a database. The model is the only entity able to access resources.<br />
[*]<strong>View</strong>: The view is an attempt to separate the most unstable part of an application: the user front-end. A view is only responsible for presenting the information that the Model gathered. A view does nothing but format the output, and can be compared to a template or report. In all MVC frameworks for web applications, only view files contain (X)HTML code, and mostly only that. They can therefore be changed <em>at any time</em> without having to touch a single line of the business logic of your application.<br />
[*]<strong>Controller</strong>: The controller is the 'brain' of the application. Consider it to be the only part of your program that can 'think' and manage the other parts. Controller files are the only ones able to <em>order</em> the Model to gather information and then pass the information obtained to the view for display.  <br />
</ul> <br />
<br />
Although the MVC seems to make things more complicated, that is part of the objective.  Since one of the advantages (and weaknesses) of PHP was its simplicity, the MVC adds complexity to bring more order and logic to the design process. The three entities are separated for just that reason, and trying to put them together can result in potential disasters, since it causes the whole  pattern to fail.<br />
<br />
Coming back to Rails, I was quite impressed by the features it offered, but there was a small problem: the Ruby programming language itself. I experienced some difficulties in setting up the environment properly, and I also discovered that most standard hosting companies do not offer Ruby hosting plans as standard. Hosting issues aside, I would have had to learn Ruby in order to master Rails, and I really did not have the time for that: I had to develop a website quickly and easily, preferably with languages I already knew.<br />
<br />
After deciding to abandon Rails (for the moment, anyway), I was amazed by the number of projects in other programming languages that try to emulate the famous Ruby framework, to the point of being considered <em>clones</em> or ports of it to another language.  To my knowledge, the <em>Rails disease</em> contaminated the following programming languages:<br />
<ul><br />
<li>PHP</li>[12]<br />
<li>Python</li>[13]<br />
<li>Java </li>[14]<br />
<li>Perl </li>[15]<br />
</ul><br />
<br />
I said <em>disease</em> because Rails developers think that Ruby on Rails was made in Ruby for a reason, namely that Ruby offered some unique features that were not available in other languages.  I will not delve into that topic here; more information is available[16] for those who are interested.  However, suffice it to say that there are some Rails ports in PHP that were immediately attacked because of the fact or legend that the creator of Rails originally wanted to develop his framework in PHP and then switched to Ruby.   Let's examine one of those PHP frameworks in detail.<br />
<br />
<br />
<strong>CakePHP: Just Another Rails Clone?</strong><br />
<br />
I chose to learn CakePHP (or "Cake")[17] mainly because it offered more features than the other two PHP alternatives.  It also  seemed to be a more original and actively developed project.  In particular, I'd like to quote one of CakePHP's developers, from when he introduced the framework in a comment to a blog post[16]: <br />
<br />
<fieldset><blockquote><br />
"While it's difficult to copy Rails in PHP, it's quite possible to write an equivalent system. I like the terseness of Ruby code, but I need the structure that Rails provides, how it makes me organize my code into something sustainable. That's why I'm ripping off Rails in Cake."<br />
</blockquote></fieldset><br />
<br />
Cake's developers (bakers?) are developing their own framework which uses many principles of Ruby on Rails, revisited and re-proposed in an extremely flexible and easy to use PHP tool, rather than simply trying to port Rails to PHP. I also liked the fact that they bothered to choose an original name for their project, unlike others: there are too many "&lt;insert language here&gt;-on-Rails" frameworks, and while the whole "Rails" thing is innovative and catchy the first time, it loses its appeal quickly when people use the word everywhere just because it is "fashionable".<br />
<br />
Quoting from CakePHP's website:<br />
<br />
<fieldset><blockquote><br />
"Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility." <br />
</blockquote></fieldset><br />
<br />
That sounds like the Holy Grail for PHP developers, and I must admit I'm quite impressed myself after using it on various little projects, but is it really all true? What are Cake's features? Are there any limitations?<br />
<br />
<br />
<strong>The Ingredients</strong><br />
<br />
So what is Cake?  In the previous sections, I introduced some general concepts and ideas common to Ruby on Rails and CakePHP, but nothing in particular was said about the structure of the framework itself.  Let's now turn to that and discuss it in some detail, particularly as it pertains to Cake.<br />
<br />
The first thing to understand about Cake (and Rails as well) is that one of their aims was to avoid editing long and complex configuration files in order to run the environment.  The approach in this sense is to use <em>conventions</em> over <em>configuration</em>. This may sound terribly restrictive, but in reality it proved  to make things much simpler. After all, I said I wanted to use a framework because I needed a solid structure to base my applications on, not that I needed to be able to create and personalize my own structure and system. Cake uses some simple rules in order to run properly, and the easiest way to explain them is through Cake's directory structure, which represents the skeleton of every CakePHP application.<br />
<br />
<strong><em>/<br />
---app/<br />
------config/<br />
------controllers/<br />
---------components/<br />
------models/<br />
------plugins/<br />
------views/<br />
---------elements/<br />
---------errors/<br />
---------helpers/<br />
---------layouts/<br />
---------pages/<br />
------webroot/<br />
---------css/<br />
---------files/<br />
---------img/<br />
---------js/<br />
</strong>---cake/<br />
------config/<br />
---------inflections/<br />
------docs/<br />
------libs/<br />
---------controller/<br />
---------generator/<br />
---------model/<br />
---------view/<br />
------scripts/<br />
---tmp/<br />
------cache/<br />
------distro/<br />
------logs/<br />
------tests/<br />
---vendors/</em><br />
<br />
I expanded only the first three levels of the tree, although there are more levels in the <em>/cake/</em> directory.  They won't be considered here simply because the <em>/cake/</em> directory contains CakePHP's internal libraries, which normally will not be modified when developing an application.  The <em>/tmp/</em> directory also will not be elaborated upon either, because it is only used to store temporary files. However, the <em>/vendor/</em> directory should contain third party scripts and libraries that you may want to use in your application, but they are not normally integrated with Cake's framework.  95% of your application will reside within the <em>/app/</em> directory, which we therefore need to examine in greater detail.<br />
<br />
<u><em>/config/</em></u><br />
When I said that Cake strives to use conventions over configuration, I really meant it.  This directory does not contain thousands of configuration files, only five very small ones. They represent the only items which <em>might</em> need to be configured. <br />
<br />
[list]<br />
[*]<strong>acl.ini.php</strong>: This file must be edited only if you plan to use Cake's default ACL (access control list) system for your application. It sets permissions for the application, so it should be used to list every group, user, and their respective rights. This can be useful for small sites with a few well known users, but for anything else, you should develop your own ACL or authentication system that relies on a database.   <br />
[*]<strong>core.php</strong>: This file can be edited to change some default options, such as the level of the error messages and notices that the application will output. This comes in very handy while developing an application.<br />
[*]<strong>database.php.default</strong>: This should be renamed to database.php and edited if you plan to use any databases with Cake. The settings are fairly straightforward, and include the type of database used (mysql, postrgres, sqlite, or any other supported by the AdoDB library[18]), username, password and database name.<br />
[*]<strong>paths.php</strong>: Unless you are very particular, you should leave this file alone. It tells Cake where to look for CSS files, images, controllers, etc. If you are planning to adopt Cake's directory structure - which is the most logical option - you can ignore this.<br />
[*]<strong>routes.php</strong>: Following Rails' example, CakePHP features a "routing system" for user-friendly URLs. By default, your URLs will look like this: <em>http://sitename/controller-name/action-name/eventual/action/parameters</em>, which is a really nice way to organize a site, but you may want to change something if you have particular requirements. <br />
[/list]<br />
<br />
<br />
<u><em>Controllers</em></u><br />
As mentioned previously, a controller represents the "brain" of the MVC pattern, the part which controls what the other parts are doing. Imagine a controller like a section of your site: its name will be present on the address bar, and each of these sections will have a file named &lt;something&gt;_controller.php, and will also contain a class named SomethingController that extends the AppController class. This class will  have some methods that correspond to some standard actions like <em>index</em> (the default action called when you access the <a href="http://sitename/controller/">http://sitename/controller/</a> page) or other user-defined ones like <em>add</em> or <em>list</em> or <em>admin</em>, depending on the application. As a general rule, you want to add any 'business logic' you want to implement in your application in controllers - for example, calculations or a database query that produces a result. <em>Then</em> once all the mess is done, the result (usually an array or a variable) is passed to the view (see <em>views</em> below). <br />
 <br />
If this is starting to sound too technical for you, I recommend reading a tutorial[19] available on the CakePHP website about creating a simple blog application. The tutorial will explain most of Cake's basics, including how to pass a variable from a Controller to the corresponding view <em>($this-set('variableNameInView', $variable))</em> and other useful things.<br />
<br />
Recently <em>Components</em> have been added to CakePHP, and quoting from the corresponding wiki page[20]:<br />
<fieldset><blockquote><br />
"Components are the preferred way to provide additional functionality to your controller. To make a component available you would add var $component = array('myComponent') inside of your controller's definition, add your file to the /app/controllers/components, name your class MyComponent, and create your methods."<br />
</blockquote></fieldset><br />
<br />
<br />
<u><em>Models</em></u><br />
A model is an object able to access the database. In Cake's terms, that is any class extending the AppModel class. That class is directly under the <em>/cake/</em> directory (along with the previously mentioned AppController class), and can be moved to the <em>/app/</em> directory and modified if you want to add some particular site-wide behavior to it which will be inherited by all models extending it.<br />
<br />
In even simpler terms, you need to create a Model class for every table you're planning to use in your database. A convention in Cake says that database table names should be plural and that the corresponding model should be singular. If you use a table named 'mice', your model should be named 'mouse': Cake is smart enough to understand irregular plurals through an <em>Inflector</em> class.<br />
<br />
Creating a model class for basic use is trivial:<br />
<br />
<br />
class Post extends AppModel<br />
{<br />
    var $name = 'Post';<br />
}<br />
<br />
<br />
Then you'll be able to access the model (and therefore the database) from a controller via simple instructions like $this-&gt;Post-&gt;findAll(). This instruction will query the database and return all records within the Posts table in your database.  You can also perform more complex operations, and also specify SQL queries to execute, if you need to, but remeber that models can only be accessed through controllers! If you need some information stored in your database to be displayed on a view, execute the query from the controller and pass it to the view as per the MVC pattern.  It can prevent you from cluttering views with business logic and thereby making code updates much harder.<br />
<br />
<br />
<u><em>Views</em></u><br />
Views are used to present information gathered with a model and a controller to the public. They are mostly HTML pages with some PHP tags in them, prints of variables and maybe some <em>foreach</em> loops. Nothing more than that should be used in a view!<br />
<br />
Views must be placed in this directory and obey the following conventions:<br />
<br />
1. They must be named after a controller's action to allow the controller to refer to a particular view automatically. The same view can be used by multiple controllers, but it must be either set manually or through a layout (see below).<br />
2. Views referring to an action of a particular controller must be placed under a subfolder named after the controller.<br />
3. All views must have a .thtml extension.<br />
<br />
Any site-wide view, like the site's template, must be placed under the <em>layouts</em> subfolder. In particular, the default.thtml file in the folder represents the global template for your application: page titles and specific pages (views) will be invoked automatically by using $title_for_layout and $content_for_layout respectively.<br />
<br />
Similarly to what was said about components, <em>helpers</em> can be used to extend views functionalities[20]:<br />
<br />
<fieldset><blockquote><br />
"Helpers are all about the view. You know about the helpers in Cake, but you need a little bit more. You want to have your own methods to display formatted info. To achieve this, you need to add var $helpers = array('myHelper').<br />
<br />
Now, throw your myhelper.php file into the /app/views/helpers/, create the class MyHelper, and $myHelper is available in the view." <br />
</blockquote></fieldset>   <br />
<br />
Cake comes with some very useful default helpers to create links and HTML tags, import JavaScript, create forms, and use AJAX code easily. Unlike most other frameworks, Cake neither has nor uses a third party template engine (like Smarty[21]) for views, but helpers can be used to achieve similar results more quickly than an engine can.<br />
<br />
<br />
<u><em>Plugins</em></u><br />
<br />
Plugins are user-developed enhancements for Cake. Unlike the files placed under the <em>vendor</em> directory, a plugin is an application specifically made to be used within the CakePHP environment. At the moment this feature is still under development.<br />
<br />
<u><em>Webroot</em></u><br />
<br />
If you read carefully what I wrote above about routes, you might be wondering if <em>every</em> page must have a controller and a view in order to be displayed properly. What about images, JavaScript and CSS files? The answer is this directory: everything you place here will not be seen as part of the MVC-based environment; CSS files can be stored in the <em>/css</em> folder, Javascript under <em>/js</em>, and so on. Additionally, some helpers can provide a easier way to access or display images, scripts, CSS, etc.<br />
<br />
<br />
<u><em>Other Features</em></u><br />
Cake offers even more than this; the latest releases have introduced a few more Rails-inspired features:<br />
<br />
[list]<br />
[*]<strong>Scaffolding</strong>: Do you want to test your application without spending time writing all the CRUD (Create, Read, Update, Delete) code? That's where the concept of scaffolding comes in:  by setting a few variables in the right places[22], Cake will generate basic mechanisms to add, edit, list, and delete records in your database, along with all the associated view files. You won't have to code a single form, as everything will be generated automatically by the framework according to SQL field types.<br />
[*]<strong>Bake</strong>: Another Rails-inspired feature revisited in PHP. Rails uses a set of scripts and in particular the <em>rake</em> utility to instantaneously create the foundation for a Rails application with scaffolds already in place.  CakePHP offers the same functionality through the <em>bake</em> utility, which is currently available as either a batch file or a PHP script.<br />
[*]<strong>ACL</strong>: As previously mentioned, Cake comes with a ready-made Access Control List (ACL) system, which can be extended and used to restrict particular areas of a Cake application to certain users or user groups.<br />
[*]<strong>Compatibility</strong>: CakePHP is fully compatible with both PHP and PHP5.<br />
[/list]<br />
<br />
<br />
<strong>Meet the Bakers</strong><br />
<br />
After reading all these things about CakePHP and its framework, you may have some questions, or be curious about some aspect of the project. PHPNut and gwoo, two of CakePHP's creators and lead developers, offered to answer some questions exclusively for zZine readers. This interview took place on Oct. 26th, 2005, in #dev-cakephp on irc.freenode.org.<br />
<br />
<em><u>h3rald</u>:</em> Thanks to both of you for allowing me to interview you about your project, CakePHP. Where did the name come from, anyway?<br />
<br />
<em>PHPnut:</em> The original project was started by Michal Tatarynowicz aka Pies (hence the name), and when I saw his release, last March, I decided to contact him.  I told him that the company I own supports projects like Cake, and also that I was in the process of developing something along the same lines. <br />
<br />
<em><u>h3raLd</u>:</em> Is Cake released under the GPL? How many developers are helping out?<br />
<br />
<em>gwoo:</em> Cake is released under the MIT license, and the development team is composed of me and PHPnut, plus four other contributors. Then there's the Documentation Team, currently 3-5 people. Documentation has to follow the releases, so it usually lags behind a bit: we made so many modifications in the recent release that the Doc Team has a lot to catch up on, but it's getting there.<br />
<br />
<em>PHPnut:</em> With this release you will see that the docs are going to be much better. The code is very stable now, and hopefully very little changes on that.<br />
<br />
<em><u>h3raLd</u>:</em> Some people, at first glance, may think that Cake is a PHP port of Ruby on Rails. How true is that? What are the differences and similarities between these two frameworks?<br />
<br />
<em>PHPnut:</em> Cake started as a port, but has evolved into something more: we discussed using the concepts that RoR offered and including them in a framework for users of PHP.  I have used PHP for a number of years, and  I am comfortable with it; this is where my passion is, and I think people who use Cake have those same passions as we developers do.<br />
<br />
<em><u>h3raLd</u>:</em> I read once that Rails was developed in Ruby because only Ruby can offer certain functionalities and features...<br />
<br />
<em>gwoo:</em> I would disagree, and I think that is proven in what we have done: sure RoR has a built in server and some other nice things, but PHP is everywhere.<br />
<br />
<em><u>h3raLd</u>:</em> Some developers, especially Perl programmers, tend to consider PHP an "inferior" language sometimes.  What do you think of that?<br />
<br />
<em>PHPnut:</em> My name says what I think about them all.<br />
<br />
<em>gwoo:</em> PHP is a web programming language; that's what it was designed for, and that's what it does best: It all boils down to what you are comfortable with.<br />
<br />
<em><u>h3raLd</u>:</em> Did you try any other PHP frameworks, MVC-based (Mojavi, for example), or event-driven, like Prado? What do you think about them? In what ways can Cake be better or worse?<br />
<br />
<em>gwoo:</em> They are all so complex, in my opinion, and I tried nearly all of them. Cake breaks apart the MVC and handle the CRUD in a logical way, and Cake syntax is super easy to learn.<br />
<br />
<em><u>h3raLd</u>:</em> Ruby on Rails has been ported to various languages, including Java and Python. There are three PHP frameworks inspired by the famous Ruby project: Biscuit, PHP on Tracks and CakePHP.  What do you think of that? Any chance of a merge? Did you have a look at them?<br />
<br />
<em>gwoo:</em> You forgot Symfony[27], a PHP5-only port: I tried it but it seems much harder to learn than Cake.<br />
<br />
<em>PHPnut:</em> I could be wrong, but I think these other projects are behind us in ease of use, in what the framework is capable of doing, and in  features, not to mention community support.<br />
<br />
<em>gwoo:</em> I tried all of the PHP ports of Ruby on Rails and none of them has the features, the community,or a lexicon as good as Cake's.<br />
<br />
<em><u>h3raLd</u>:</em> Why don't you consider CakePHP a port? In what way is it evolving from Rails?<br />
<br />
<em>PHPnut:</em> Rails and CakePHP share a lot: MVC pattern, Active Record pattern...but we're not strictly following Rails, and we're able to think by ourselves. Recently we changed the directory structure, and in my opinion our is more functional than the Ruby on Rails one.<br />
<br />
<em><u>h3raLd</u>:</em> What can Cake be used for? What kind of projects? Are there any limitations?<br />
<br />
<em>gwoo:</em> Personally I think that Cake is the most extensible framework out there for PHP: with components, helpers and vendor access you can do anything you want!<br />
<br />
<em>PHPnut:</em> We are limited only by what a web server (generally Apache, but IIS seems to work as well) and a database can do. We may be limited by PHP itself, but we twist that in our own little sick ways sometimes.<br />
<br />
<em><u>h3raLd</u>:</em> Any thought about AJAX? I saw some nice demos made with Cake.   What do you think of this new trend in web development? Some people consider it the future, while others are concerned about compatibility, and still others are relatively indifferent to it.  What about you?<br />
<br />
<em>gwoo:</em> AJAX can be very useful in creating an application, but should not be overused. People have become very comfortable with how the Web works:i f you start doing tons of drag and drop and no refreshes, users will feel lost in how to operate the site.<br />
<br />
<em><u>h3raLd</u>:</em> Thank you very much for your time, both of you. Is there anything you'd like to add to this interview? Something you'd like to say to users interested in trying out Cake?<br />
<br />
<em>PHPnut:</em> Come and enjoy: we are here to help...<br />
<br />
<em>gwoo:</em> ...And plan to be here for a very long time!<br />
<br />
<br />
<strong>Let's cook...</strong><br />
<br />
One of the most positive things about CakePHP is that even though it is a fairly new project (most of the code is 100% useable already,but  they still consider the projectto be in the 'alpha' stage), it's maintained by many dedicated developers and PHP enthusiasts. I was amazed to see how the whole documentation evolves and is quite literally updatedon a daily basis. <br />
Anybody can contribute to the framework or simply test it and share their experiences.<br />
<br />
<u><em>CakePHP Wiki</em></u><br />
<br />
Anybody can register an account for free and contribute tutorials and documentation to the new CakePHP Wiki[23]. This is currently the most up-to-date source for documentation files and tutorials.<br />
<br />
<u><em>CakePHP User Group</em></u><br />
<br />
If you need assistance or you want to contact the Cake developers or other Cake users, you can post a message on their Google User Group[24]: people will reply with useful comments, usually on the same day, and the developers <em>do</em> listen to user suggestions.<br />
<br />
<u><em>CakePHP IRC Channel</em></u><br />
<br />
If you want to offer (or receive) real-time assistance, feel free to join #cakephp on FreeNode (irc.freenode.org). I went there disguised as a total newbie (it wasn't much of a stretch) and they helped me a lot, explaining basic concepts of the framework and pointing me to the right documentation files.<br />
<br />
<u><em>CakePHP Development</em></u><br />
<br />
Experienced PHP developers are more than welcome to contribute to the project. People may be accepted to the core development team if they have sufficient knowledge and spare time, or alternatively,components or code can be submitted through the newly created CakeForge[24].  <br />
<br />
<br />
<strong>...Or Just Eat</strong> [small]<em> by Marc Abramowitz</em>[/small]<br />
<br />
If you don't feel ready to contribute and you'd like to try out the framework first, it can be downloaded directly from the CakePHP site[25] as either a  <em>release</em> or a <em>nightly</em> build: the zip file is less than 300KB.<br />
<br />
I wanted to include a <em>success story</em> written by Marc Abramowitz, an experienced PHP programmer who decided to adopt CakePHP as a framework to use in a production environment: he persuaded his colleagues to use it and they all seem happy with it.  He writes:<br />
<br />
<em>For the past few years, I've done quite a bit of work in PHP, working on production code that runs on a very high traffic web site. PHP has served us well, as it is easy to write and read, quite efficient, and easy to integrate with existing C++ code as the site grew.<br />
<br />
Lately, there has been a lot of buzz in the web development community about Ruby on Rails. Like many others, I took some interest in Ruby on Rails because I was intrigued by the apparent power and elegance of Ruby and because I wondered if a Model/View/Controller (MVC) framework like Rails would help enforce a more consistent code structure that would make the code easier to understand and maintain. Additionally, I wondered if an MVC framework would enable very rapid prototyping.<br />
<br />
Some people are very wary of frameworks that impose structure, as they like to have the freedom to do things however they want. However, there is a tradeoff between structure and flexibility. If you're working on a small team or a relatively small project, then you may not find structure to be very helpful; you may even find that it gets in your way. <br />
<br />
However, as teams and projects get larger, structure becomes more and more valuable, as it enforces consistent patterns of how to do things and rather than being something that limits, it in fact liberates, because it abstracts away the small details and allows us to therefore concentrate on the larger problem. Think of the lines that are painted on our roadways - although they add structure, we don't find them to be limiting. On the contrary, they help us to drive without worrying about crashing into each other at every moment - they free us from being concerned with small details so that we can concentrate on getting where we're going.<br />
<br />
Rapid prototyping appeals to me, because I find it helps me to better present my ideas for new apps and features. A mockup can only go so far - there is no substitute for a working prototype. When clients get their hands on a functional prototype, they get a better idea of what is possible and it forces them to clarify their requirements for the product. This results in a better dialogue between the developer and the client, which leads to better upfront decisions, more stable requirements, less stress, and a better product.<br />
<br />
So, Rails appealed to me not only because of the potentially valuable structure that it could add, but also because it could enable rapid prototyping. However, I knew that there was no chance of Rails being used for production code in my organization, because we run some very high traffic web sites that require the utmost in efficiency.  We are also by and large a PHP shop.<br />
<br />
However, when my manager approached me and asked me to develop a database-backed internal tool, I thought of Rails again.  I then considered the fact that I would probably someday have to hand this app off to someone else, and that someone would probably know PHP but not Ruby. Heck, even I had several years of experience with PHP (including writing some PHP extensions) but I had only done a little bit of reading about Ruby, and I also had no practical experience with it.<br />
<br />
Furthermore, with PHP I had access to a large number of PHP extensions that wrapped various internal libraries. So PHP was the natural choice. Ideally, I wanted to use PHP with a Rails-like MVC framework that would facilitate rapid development, and this is what led me to CakePHP.<br />
<br />
I began by downloading CakePHP 0.9.2 and following the sample tutorial that walks you through creating a simple blog application (note that at the time of this writing, the current version of Cake is now 0.10.0.1076, so some of the details of using Cake have changed). I was pleased to find that the process was quite similar to the process for Rails. One difference that I noted was that Rails tutorials always emphasize using scripts to generate models, controller, and scaffolds, whereas the Cake tutorial walked me through explicitly writing out all the code. I noticed that the Cake download came with a script called "bake" which looked like something that could potentially do some of the code generation, but since it wasn't mentioned in the tutorial, I chose not to use it.<br />
<br />
The process of creating a first application using the tutorial was quite easy. Here are the steps in brief (consult the tutorial for more details):<br />
<br />
1. Create the database table. Cake requires tables to have some extra<br />
fields:<br />
  - id, an auto_increment primary key<br />
  - created, a datetime<br />
  - updated, a datetime<br />
2. Configure Cake to access the database by editing the config/database.php file<br />
3. Create a model class which extends AppModel (a Cake provided class)<br />
4. Create a controller class which extends AppController (a Cake provided class) and write one or more controller methods<br />
5. Create a view which is a PHP file with a .thtml extension and is meant to be mostly HTML with very little embedded PHP - typically just echoing of variables and some simple control structures like [i]foreach</em>.<br />
Cake also provides some simple convenience methods that write out certain HTML constructs for you.<br />
<br />
That's it! That alone is enough to create a basic but functional application. The tutorial goes on to show you how to add additional functionality to the blogging app. After that there's a shorter, more advanced tutorial that shows you how to add a few more things to the blogging app.<br />
<br />
Once I had gotten comfortable with Cake by following the tutorial, I proceeded to write my own application. Getting started was easy - I followed the same steps as in the tutorial to create my first table, model, controller, and views, then my second table, model, controller, and views. Then my app got a bit more complicated. I needed to have many-to-many relations and more elaborate queries than the default ones that Cake provides. I began to worry that Cake would break down here. I had heard people grumble that MVC frameworks like Rails and Cake were great for little toy apps that only do CRUD (Create, Read, Update, Delete), but that they couldn't handle complex queries using joins and the like. I poked around in the Cake source code and was pleased to find that there were nice lower level methods that allowed me to bypass the Cake defaults and do whatever custom queries I liked. For example, I wrote something like this in one of my models:<br />
<br />
function index(){<br />
           return $this-findBySql(<br />
               "SELECT id, title, AVG(rating) avg_rating, MIN(rating) min_rating, MAX(rating) max_rating, COUNT(rating) num_ratings " .<br />
               "FROM ideas LEFT JOIN ratings ON ideas.id =<br />
ratings.skill_id " .<br />
               "GROUP BY id " .<br />
               "ORDER BY title");<br />
       }<br />
<br />
<br />
So what I have is a model that does <em>not</em> have a one-to-one mapping with a single table. It actually retrieves data from more than one table.<br />
<br />
Over time, I picked up a few more Cake concepts. For example, at some point we decided that every page of the app would have a similar look and feel with a particular masthead and logo, and all the pages in one section of the site would show tabs for all of the various views with the currently selected tab highlighted. At first, I just used the same code at the top of each of my views to display the masthead, logo, and tabs. This, of course, became a pain when I needed to change the layout, since I needed to make the same change in several different views.<br />
<br />
Then one day I realized that Cake had a concept of layouts, which are high level templates in  <em>app/views/layouts</em> that define the basic structure of pages.  The individual views are just content that gets embedded in these high level layout templates. So I took the common masthead and logo, put it in my default layout, and removed it from the individual views. Now when I wanted to change the look of the masthead, I only had to do it in one place. For the tabs, I discovered the concept of elements. I placed the code for my tabs in <em>apps/views/elements/tabs.thtml</em>.  Then the tabs could be displayed in any template using:<br />
<br />
&lt;?php echo $this-renderElement('tabs') ?<br />
<br />
Rather than stick the above statement in all of the many pages that were supposed to display tabs, I created a new layout in <em>apps/views/layouts/tabbed.thtml</em> (which uses renderElement to render the tabs). Then I used<br />
<br />
$this-layout = "tabbed"<br />
<br />
in the controller to tell it to use the tabbed layout rather than the default (non-tabbed) layout.<br />
<br />
After a couple of days of work on this application, it was time to demo it to the VP, who was very impressed with what I was able to accomplish in such a short period of time. It was brought up that before I took on the project they had asked some other folks how long it would take them to build it in Java and they had said that it would take on the order of months what I had built in a couple of days. Morals of the story:<br />
<br />
1. Cake is very lightweight and productive<br />
2. Cake might be very beneficial to your career<br />
<br />
Eventually, I was assigned to another project and my manager wanted me to transition my Cake project to another engineer, who was experienced with PHP but not with Cake. I sat down with the new engineer and in about 20 or 30 minutes of explanation and walking him through the code,<br />
he felt ready to code. Not only did he feel that he knew enough to start working with the application, I could tell from the smile on his face that he was very impressed by the power and succinctness of Cake, which was the  same reaction that I initially had. After a couple of days, I checked back with him and he had made a remarkable amount of progress on the application - there were a ton of new pages and features.<br />
<br />
So you see, Cake is a very productive environment. For a very small investment in the initial learning curve, you can get a significant increase in productivity.<br />
[/i]<br />
<br />
<strong>...And the icing?</strong><br />
<br />
So that's what CakePHP is about. The project may only have just entered alpha stage, but the code is already very stable and useable, as PHPnut, gwoo and Marc said.  So what's going to be included in the beta and stable releases? I researched a bit and asked the developers, and here's how Cake will probably evolve in the following months:<br />
<br />
<ul><br />
<li>Cake's built-in </li><strong>data-validation</strong> capabilities will be extended. A validator class - which already exists, by the way - will be extended to include more data types and expressions to be validated before being stored in a database. <br />
<li>A new default </li><strong>ACL system</strong> will be included and will support database access and .ini files as well. <br />
<li> The </li><strong>AJAX</strong> helper class and AJAX support will be enhanced, featuring unobtrusive JavaScript and ALA behavior[28].<br />
<li> </li><strong>Multiple applications</strong> with the same core files. In the future developers will be able to create their own Cake application which could be placed in the app/plugins directory and be seamlessly integrated and auto-linked to other Cake applications.<br />
</ul>   <br />
<br />
After learning all this about Cake and after trying it out myself, I really think that I have found the solution to all of my PHP web development problems. CakePHP can really help PHP developers a lot if properly used and understood.  Still not convinced? Just try it out then, will you?[17]<br />
<br />
<br />
<strong>Notes and Related Resources</strong><br />
<br />
Special thanks to:<br />
<ul><br />
[*]<strong>Larry E. Masters aka <em>PhpNut</em></strong> and  Garrett J. Woodworth <strong>gwoo</strong> for providing all the answers to my questions and contributing to create such a wonderful tool for the PHP community.<br />
[*]<strong>Marc Abramowitz</strong> for sharing his experiences with the CakePHP framework and providing the content for the '...let's eat' section.<br />
</ul><br />
<br />
[small]<br />
[1] PHP functions reference, <a href="http://www.php.net/manual/en/funcref.php">http://www.php.net/manual/en/funcref.php</a><br />
[2] Framework, Wikipedia Page - <a href="http://en.wikipedia.org/wiki/Framework">http://en.wikipedia.org/wiki/Framework</a><br />
[3] .NET framework overview - <a href="http://msdn.microsoft.com/netframework/technologyinfo/default.aspx">http://msdn.microsoft.com/netframework/technologyinfo/default.aspx</a><br />
[4] "PHP Framework", delorian's blog, PHP Community - <a href="http://www.phpcommunity.org/node/100">http://www.phpcommunity.org/node/100</a><br />
[5]Some popular PHP frameworks: Mojavi (<a href="http://www.mojavi.org/">http://www.mojavi.org/</a>), phpMVC (<a href="http://www.phpmvc.net/">http://www.phpmvc.net/</a>), BlueShoes (<a href="http://www.blueshoes.org/">http://www.blueshoes.org/</a>), Seagull (<a href="http://seagull.phpkitchen.com/">http://seagull.phpkitchen.com/</a>).<br />
[6] PEAR - <a href="http://pear.php.net/">http://pear.php.net/</a><br />
[7] Prado - PHP Rapid Application Development Object-Oriented, <a href="http://www.xisc.com/">http://www.xisc.com/</a><br />
[8] Event Driven Programming, Wikipedia Page -  <a href="http://en.wikipedia.org/w/index.php?title=Event_driven_programming">http://en.wikipedia.org/w/index.php?title=Event_driven_programming</a><br />
[9] Ruby on Rails, Official Page - <a href="http://www.rubyonrails.org/">http://www.rubyonrails.org/</a><br />
[10] Ruby on Rails, Doumentation - <a href="http://documentation.rubyonrails.com/">http://documentation.rubyonrails.com/</a><br />
[11] Model View Controller, Wikipedia Page - <a href="http://en.wikipedia.org/w/index.php?title=Model-View-Controller">http://en.wikipedia.org/w/index.php?title=Model-View-Controller</a><br />
[12] PHP frameworks inspired by Rails: <a href="http://phpontrax.com/">http://phpontrax.com/</a>, <a href="http://flinn.activeintra.net/biscuit/">http://flinn.activeintra.net/biscuit/</a>, <a href="http://www.cakephp.org/">http://www.cakephp.org/</a><br />
[13]Python frameworks inspired by Rails: <a href="http://fanery.sourceforge.net/">http://fanery.sourceforge.net/</a>, <a href="http://fanery.sourceforge.net/">http://fanery.sourceforge.net/</a>, <a href="http://subway.python-hosting.com/">http://subway.python-hosting.com/</a><br />
[14]Java framework inspired by Rails: <a href="https://trails.dev.java.net/">https://trails.dev.java.net/</a><br />
[15]Perl frameworks inspired by Rails:<br />
<a href="http://search.cpan.org/dist/Catalyst/lib/Catalyst/Manual/Intro.pod">http://search.cpan.org/dist/Catalyst/lib/Catalyst/Manual/Intro.pod</a>, <a href="http://perlonrails.org/index.php/Main_Page">http://perlonrails.org/index.php/Main_Page</a> <br />
[16] "Rails Clones: Blood suckers or useful drones?", RedHanded - <a href="http://redhanded.hobix.com/cult/railsClonesBloodsuckersOrUsefulDrones.html">http://redhanded.hobix.com/cult/railsClonesBloodsuckersOrUsefulDrones.html</a><br />
[17] CakePHP - Rails-inpired PHP framework, <a href="http://www.cakephp.org/">http://www.cakephp.org/</a><br />
[18] AdoDB, PHP Database Abstraction Layer - <a href="http://adodb.sourceforge.net/">http://adodb.sourceforge.net/</a><br />
[19] CakePHP blog tutorial - <a href="http://wiki.cakephp.org/tutorials:blog_tutorial_-_1">http://wiki.cakephp.org/tutorials:blog_tutorial_-_1</a><br />
[20] Extending CakePHP -  <a href="http://wiki.cakephp.org/tutorials:extending_cake">http://wiki.cakephp.org/tutorials:extending_cake</a><br />
[21] Smarty, PHP Template Engine - <a href="http://smarty.php.net/">http://smarty.php.net/</a><br />
[22] Scaffolding a Blog, CakePHP Wiki - <a href="http://wiki.cakephp.org/tutorials:scaffolding_a_blog">http://wiki.cakephp.org/tutorials:scaffolding_a_blog</a><br />
[23] CakePHP Wiki - <a href="http://wiki.cakephp.org/">http://wiki.cakephp.org/</a><br />
[24] CakePHP Google User Group - <a href="http://groups.google.com/group/cake-php">http://groups.google.com/group/cake-php</a><br />
[25] CakeForge - <a href="http://cakeforge.org/">http://cakeforge.org/</a><br />
[26] CakePHP Downloads Page - <a href="http://cakephp.org/downloads/">http://cakephp.org/downloads/</a><br />
[27] Simfony, PHP5 framework - <a href="http://www.symfony-project.com/">http://www.symfony-project.com/</a><br />
[28] ALA behavior - <a href="http://bennolan.com/behaviour/">http://bennolan.com/behaviour/</a><br />
[/small]]]>
    </content>
  </entry>
</feed>

