all repos — h3rald @ 84f547529d0762f1a58d45b87c4fcc9fdbd21f5d

The sources of https://h3rald.com

content/articles/rails-inspired-php-frameworks.textile

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
----- 
subtitle: "A roundup of six different PHP frameworks inspired by Ruby on Rails"
popular: true
permalink: rails-inspired-php-frameworks
filters_pre: 
- redcloth
title: Rails-inspired PHP frameworks
comments: 
- :date: 2007-07-31 20:57:30 +02:00
  :author: George
  :url: ""
  :id: 43
  :body: |
    Hey, great article and amazingly designed site you got here. Thanks for the info.

- :date: 2007-10-18 10:22:03 +02:00
  :author: RailsGuy
  :url: ""
  :id: 101
  :body: |-
    It's funny how PHP developers are just now discovering MVC. This pattern has been around long before the internet and was adapted into MVC2 for web application mostly by pioneering Java developers.
    
    If Rails is what these PHP frameworks strive to be, then why not just use Rails? PHP frameworks will never be as good as Rails, not unless they change PHP itself. The language is just not dynamic enough to do what rails does with Ruby's reflection and meta programming.
    
    This post shows just how fragmented the PHP community is, and will continue to be.
- :date: 2007-10-18 15:23:11 +02:00
  :author: Fabio Cevasco
  :url: http://www.h3rald.com
  :id: 102
  :body: "RailsGuy: Thanks for your comment. A year ago I would have argued endlessly on how CakePHP is better than Rails and all that. Now I agree 100% with you and this very site is now powered by Rails and Typo! :-)"
- :date: 2007-12-17 13:56:57 +01:00
  :author: lexor@cyberspace.org
  :url: ""
  :id: 169
  :body: |-
    The article seems to be truthful. Symfony could be different a year ago, but I can't agree that it's directory structure is confusing and disorganized. You can customize it, some folders are required to store data provided by functionality that is missing from other frameworks - think about it!
    
    >>Uses too many configuration files, not suitable for simple projects
    I know the only simple project - "Hello, world!". You can't create infinitely simple and mega powerful framework - these are contradictory requirements.
    Btw, do you know that a powerful admin interface can be generated based on a config file ONLY?
    
    >>Steep learning curve
    It's worth it.
- :date: 2008-01-13 15:56:32 +01:00
  :author: Arrms
  :url: ""
  :id: 200
  :body: |-
    Some php developers have been doing mvc style work since 2000.
    
    Including hacked reflection and dynamic type code. 
    
    PHP 5 is a big step towards fixing a lot of the issues, and a lot of the comments made seem very un-informed about php.  Yes php has a lot of bad programmers around because its so easy to hack up some webpages.
    
    I've used a lot of the frameworks around and they are all fine as long as long as you do what they want, when you want to do something they don't do is when you run into problems.
    
    Rails and Ruby look great but if scalability is a big issue then its just not viable. I'm sure that will be fixed in the future. It will be the same as php, there will be a huge amount of poor programming done in these initial days etc etc.
    
    And I'm not a big fan of any of the PHP frameworks out there at the moment, they could be done a lot better. The more decent frameworks are only seen in commercial products unfortunately.
    
    PHP has reflection now, and you can call methods and classes using variables... which seems to be what ruby claims as dynamicness that php doesn't have. Using wonderful reflection magic is going to involve a performance hit. So if that's a great claim on why to use language X, and your going to go crazy using it thats all well and good, but your performance and bugging are going to be a pain.
    
    
    Activerecord magical database crazyness, is all great, but if you want to tweak performance quite often you have to do some of the work yourself anyway. And I really fail to see some of the real differences that people claim.
    
    But anyway, good review etc etc.
- :date: 2008-07-04 10:29:54 +02:00
  :author: karan
  :url: ""
  :id: 245
  :body: i have learn more from your site it is very useful to student who study php
date: 2006-05-03 14:57:00 +02:00
tags: 
- frameworks
- review
- cakephp
- rails
type: article
toc: true
intro: There are various articles online examining many PHP frameworks, providing short reviews or comparative charts, but I could not find yet an article  examining the so called _"Rails-inspired frameworks"_ anywhere on the web, so I decided to write my own...
-----
There are various articles online examining many PHP frameworks, providing short reviews or comparative charts, but I could not find yet an article  examining the so called _"Rails-inspired frameworks"_ anywhere on the web, so I decided to write my own...

bq. *IMPORTANT UPDATE:* I do no longer recommend the CakePHP framework anymore due to the "unprofessionalism of some member of its development team":http://www.h3rald.com/blog/42. My site is now powered by Ruby on Rails and I totally lost interest in PHP and any PHP framework. If you are looking for a decent web framework, try "Ruby on Rails":http://www.rubyonrails.org (for Ruby), "Django":http://www.djangoproject.com/ (for Python) or "Catalyst":http://catalyst.perl.org/ (for Perl).
I'm talking about those PHP frameworks who give at least part of their success to Ruby on Rails[2], but don't call them _clones_ or _ports_ as some of their creators may get offended.

!</img/pictures/rails.gif!

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 _have_ 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 PHP spaghetti code: you can't, it's too much, it will be too tangled up and in the end you'll lose your mind trying to find that _small insignificant bug_ which makes your web application completely useless. 

Yes, you could use Rails, but maybe you don't know or don't want to learn Ruby, your host doesn't support it, your boss loves PHP etc. etc. If you're in this situation or you simply would like to know what's going on at the PHP front of the Rails Clone War, you should keep reading this article.

I'd like to introduce - briefly - six Rails-inspired PHP frameworks and compare them with each other, to point out their features, their pros and cons.

bq. _*Disclaimer:* I'm a CakePHP[3] fan, this site has been built with CakePHP and I even wrote something[4] about it in the past. This makes me inevitably partial and more familiar with this particular framework, but I'll try my very best to provide a relatively objective analysis. Obviously frameworks which are not based on the MVC architechture and that weren't inspired by Ruby on Rails have not been included, so forget things like PRADO, Qcodo, eZComponents, or even Mojavi: it's not that they are "bad", they've just been left out because they are not pertinent to this article_

h3. CakePHP

!>/img/pictures/CakePHP_1.0.png!

*Website:* "www.cakephp.org":http://www.cakephp.org/
*PHP version:* PHP4 and PHP5
*License:* MIT[5]
*Download size (.tar.gz):* 184KB
*Supported Databases:* MySQL, PostgreSQL, SQlite, MS SQL + any other supported by ADOdb or PEAR::DB database abstraction layers
*Beginner's Tutorial*: "Blog Tutorial":http://wiki.cakephp.org/tutorials:blog_tutorial_-_1

*Official Description:*
_"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."_

*PROs:*

* Lightweight, not bloated, containing only essential code
* Runs both on PHP4 and PHP5
* No configuration needed - except for a stupidly short database configuration file and a few constants which _can_ be modified. You can literally start baking in less than five minutes
* Extended table association support, allowing the creation of complex database architechtures
* Extremely logical and functional directory structure: better than Rails, if you ask me.
* Enhanced AJAX support through the AJAX and Javascript view helpers
* useful "bake" command line script to generate parts of the  code automatically
* Very active community and plenty of _satellite sites_
* Suitable for every kind of website, from the small personal site to the advanced e-business application.

*CONs:*

* No "official" internationalization support for now, but it will be included in the next milestone.
* It does not take fully advantage of PHP5 features
* Official documentation still needs some some improvement, although now it seems pretty complete and exhaustive.

*Comments:*
CakePHP is my personal favorite: easy to learn, easy to use,multi-purpose and not bloated. Cake's philosophy is not to include unnecessary code in the framework unless it'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 _if developers need them_. 
Cake's success is partly determined - at least initially - by the fact that it can run fine with no limitations on PHP4, while other similar frameworks don'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 _in PHP, for PHP_. 


h3. Symfony

!>/img/pictures/symfony.gif!

*Website:* "www.synfony.project.com":http://www.symfony-project.com/
*PHP version:* PHP5
*License:* Symfony[6]
*Download size (.tgz):* 1255KB
*Supported Databases:* MySQL, PostgreSQL, SQLite, Oracle, MS SQL + any other supported by Creole database abstraction layer
*Beginner's Tutorial*: "My first project":http://www.symfony-project.com/tutorial/my_first_project.html

*Official Description:*
_"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. [...]_
_Symfony is an object-oriented PHP5 framework based on the MVC 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."_

*PROs:*

* Fully featured framework, includes everything you might ever need (see CONs, below)
* Full native internationalization support
* Truly excellent documentation, tutorials, wiki, book, screencasts, API, real-world examples, etc. etc.
* Code generators
* Various "pre-built" modules/libraries for the most common tasks
* It was not inspired only by Rails, but borrows concepts and practices from various other frameworks
* Good community support

*CONs:*

* Seems too big compared to the others, too many "extras" which may not be useful to _all_ developers 
* PHP5 only
* Confusing and disorganized directory structure
* Uses too many configuration files, not suitable for _simple_ projects
* Steep learning curve

*Comments:*
Symfony is really an interesting framework: it's perhaps the most _complete_ 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 _almost_ the same things (or will soon be able to) in a _MUCH_ simpler way. A nice blend of MVC, pre-built components, command line generators and YAML/Propel configuration files, but perhaps a bit _disorganized_ in its internal structure, unlike its wonderful documentation and support section.

h3. PHP on Trax

!>/img/pictures/phpontrax.jpg!

*Website:* "www.phpontrax.com":http://www.phpontrax.com/
*PHP version:* PHP5
*License:* MIT
*Download size (.tgz):* 843KB
*Supported Databases:* Any database supported by PEAR::DB
*Beginner's Tutorial*: "How to create a Trax application":http://svn.phpontrax.com/wiki/HowToCreateATraxApplication

*Official Description:*
_"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."_

*PROs:*

* Simple, logical, essential: a true RoR port to PHP5
* Code generators, like Rails
* Zero configuration (like Rails and Cake
* Easy and logical directory structure (the same as Rails)
* Supports table associations, but more in a way which is more similar to Ruby on Rails than Cake.

*CONs:*

* Lack of documentation compared to the others
* Trying to port Ruby on Rails to PHP, ignoring why RoR was not built in PHP in the first place[7]
* No internationalization or other advanced functionalities
* PHP5 only
* Small community
* DBO class based only on PEAR::DB

*Comments:*
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 PHP (even in the name!). Some may say that this is a lost battle since the beginning - or better, since before it started - but others found that PHP on Trax can be the easiest way to switch from Ruby on Rails to a PHP equivalent. Who is going to do that? Well, Ruby programmers _forced_ to develop in PHP, maybe. Not too good, but not too bad either.


h3. Code Igniter

!>/img/pictures/codeigniter.jpg! 

*Website:* "www.codeigniter.org":http://www.codeigniter.com/
*PHP version:* PHP4 and PHP5
*License:* CodeIgniter[8]
*Download size (.zip):* 609KB
*Supported Databases:* MySQL, PostgreSQL, SQLite, MySQLi, MS SQL + ODBC
*Beginner's Tutorial*: "Hello World! Introduction to Code Igniter":http://www.codeigniter.com/videos/ci_intro.mov [video]

*Official Description:*
_"Code Igniter is an Open Source Web Application Framework that makes writing kick-ass PHP programs simple as apple pie. [...] Designed to enable, not overwhelm, Code Igniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications._
_If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you'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."_

*PROs:*

* Good and organized documentation
* Zero configuration (like Rails and Cake)
* Includes various classes and libraries for common tasks
* Compatible with PHP4 and PHP5
* Medium-sized community
* Intuitive directory structure
* Ships with the full user guide included in separate HTML files

*CONs:*

* No full ("written") tutorials except the videos!
* Relatively new to the scene, but growing
* Does not seem to support table associations.


*Comments:*
People on the Net seem to be rather enthusiastic about this framework: where there's a thread about the _big ones_ (Cake and Symfony), there'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'd opt for CakePHP or Symfony for a large scale application: something is missing, e.g., most notably, table associations.


h3. Biscuit

!>/img/pictures/biscuit.gif!

*Website:* "biscuitproject.tigris.org":http://biscuitproject.tigris.org/
*PHP version:* PHP4 and PHP5
*License:* MIT[5]  
*Download size (.zip):* 240KB
*Supported Databases:* Any database supported by PEAR::DB
*Beginner's Tutorial*: "Creating a simple application using the Biscuit MVC framework":http://bennolan.com/biscuit/tutorial.html

*Official Description:*
_"The mission of this project is to port Ruby on Rails to PHP5 (minus the Ruby part ;-)"_

*PROs:*

* Zero configuration, easy to deploy
* Runs both on PHP4 and PHP5
* Simple to learn

*CONs:*

* Still under development and incomplete
* Offers a limited subset of the features and functionalities offered by competitors: no internationalization, no table associations, no scaffolding... 
* _"Documentation coming soon"_
* Almost non-existent community
  

*Comments:*
This project started as an attempt to create something simpler than CakePHP and more similar to Rails. I'm not sure whether the project is still active or not, since the last "release" on the former's developer site is dated August 2005. Still in early stage - or dead.

h3. Pipeline

!>/img/pictures/livepipe.jpg! 

*Website:* "livepipe.net/pipeline/":http://livepipe.net/pipeline/
*PHP version:* PHP5
*License:* Pipeline[9]
*Download size (.zip):* 288KB
*Supported Databases:* SQLite
*Beginner's Tutorial*: none

*PROs:*

* Simple directory structure
* Suitable for small projects
* Comes with various ready-made components
* Supports table relationships

*CONs:*

* PHP5-only
* Too restrictive: only SQLite supported, _kindly suggests_ developers to use its built-in features only
* No documentation or tutorials, just the API 
* Not suitable for large projects
* Almost non-existent community

*Comments:*
This project mainly borrowed the MVC 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 _only_ SQLite, and basically tells developers what to do. In my opinion it's not flexible enough to be compared to the others, and it's simply not suitable for anything other than small websites. 

h3. Conclusions

My favorite framework still remains CakePHP, it's simple and yet powerful, easy to learn and use, mature, well supported and continuously improving. Symfony - at the moment - 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't need any and can be used for (almost?) equally complex projects.
Although I didn't have a chance to try them out, PHP on Trax is certainly the most faithful port of Ruby on Rails to PHP, 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...

At any rate, developers should _always_ choose the best framework for their needs: I tried to write a quick comparative analysis of these six Rails' "PHP children", now it's _your_ turn, try out some of them, if you choose wisely you won't be disappointed.

h3. Notes

fn1. They are all distributed according to various Open Source licenses.

fn2. "Ruby on Rails":http://www.rubyonrails.org - Ruby framework for web development

fn3. "CakePHP":http://www.cakephp.org - Rapid [PHP] Development Framework

fn4. "CakePHP - A 'tasty' solution for PHP programming":/articles/view/cakephp, originally published on "zZine Magazine":http://www.zzine.org/articles/cakephp

fn5. Open Source "MIT License":http://www.opensource.org/licenses/mit-license.php.

fn6. Symfony License:
<small>
<blockquote>
Copyright (c) 2004-2006 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</blockquote>
</small>

fn7. Read the comments by David Heinemeier Hansson on "Ruby on Rails to Basecamp":http://www.37signals.com/svn/archives/000606.php

fn8. CodeIgniter "License Agreement":http://www.codeigniter.com/user_guide/license.html

fn9. Pipeline is licensed under the same terms as the Symfony framework [Copyright (c) 2006 Picora Pipeworks LLC].