APPENDIX B
How CakePHP Compares with
Other Frameworks

To give you a sense of what to expect from Cake, this appendix compares it to some other popular web frameworks.

PHP Frameworks

Currently, the most popular PHP frameworks include the following:

Each of these frameworks is built in the PHP language, but they differ in their methods and libraries. Other frameworks could be listed here as well (PHP has a large and growing number of frameworks compared to other languages), but I'll stick with these four. No doubt others will emerge, but I expect these to continue to be the most dominant players in the PHP frameworks market. For a comparison of some of these frameworks' basic information, see Table B-1.

Table B-1. Basic Information

Framework Official Support Group Latest Version1
CakePHP Cake Software Foundation 1.2 rc1
CodeIgniter EllisLab 1.6.2
Symfony Sensio Labs 1.1 rc2
Zend Framework Zend Technologies 1.5.2

___________

1. As of the writing of this book.

Using the Various Frameworks

Each of these frameworks has been released as open source projects, which means that a lot of the development work relies on community support. Tracking bugs, writing supporting documentation, and providing general support are tasks that involve developers like you. Many times, regardless of the framework you choose, you'll go to the online community for help. The size of the community and the available online resources may have an impact on how well you experience the framework.

In the following sections, I discuss some of the current features of each framework's online community and how they assist their users in developing software. I'll also describe some basic observations when using the various frameworks and compare each one to Cake. I recognize that much more could be said about each framework, but my aim is to give you an overview of the user experience relative to Cake, not to write an exhaustive comparison of all the frameworks. You'll get a general sense of what it's like to move from one of these frameworks to Cake and where to begin when considering making Cake your primary development framework.

CakePHP

Throughout the book, I've mentioned some main web sites where you can participate in the Cake community. Table B-2 lists these and other web sites to check out for more information on CakePHP.

Table B-2. CakePHP Community Web Sites

URL Details
www.cakephp.org Home page of CakePHP
http://bakery.cakephp.org The Bakery; contains articles, code, and other announcements about CakePHP
http://groups.google.com/group/cake-php Discussion group; contains thousands of discussions about the framework and is a great resource for getting questions answered
www.cakeforge.org Repository for open source CakePHP projects; great resource for downloading third-party Cake applications and plugins
http://trac.cakephp.org Cake's support web site and tracking system; here, you can view and submit tickets related to releases of Cake
http://live.cakephp.org The Show; a live Internet radio podcast for all things CakePHP
irc://irc.freenode.net/cakephp Main IRC chat room for discussing CakePHP

The amount of activity on the web sites and chat room listed in Table B-2 is high; to date, Cake has been downloaded more than 680,000 times and remains one of most often searched web frameworks.2 The discussion group has almost 9,000 active members and has an archive of more than 54,000 moderated threads. At any given moment, the IRC chat room usually has between 100–200 visitors.

Duplication throughout the community is kept to a minimum, so expect to be directed to a thread or blog post that someone has already used to address the same topic when asking a question or requesting support. You will also probably sense a feeling of perfectionism in the community. What I mean by that is this—the Cake Software Foundation, which manages Cake's development, could have easily taken shortcuts when developing the framework. Compared to other frameworks, Cake would already be considered a version 3.0 or 4.0, but it's currently at 1.2. This is due more to really tightening up the framework rather than cooking up something fast that could perform a large plethora of methods. The result of this strategy is that Cake really is more robust, mature, and well written than it otherwise would be, and you can count on it maintaining its robustness as it takes on more fancy methods. I, by no means, am diminishing the large quantity of built-in methods that rival any other framework's functions; I'm merely pointing out that one of Cake's key advantages is its architecture, or, in other words, its methodology—which has been very carefully designed and tested.

Perhaps Cake's most competitive feature is its find methods for data handling. In this book, I've explained how to use the find() model function to easily fetch database records without writing SQL or other data source queries. By setting find conditions and other parameters effectively, you cut down on the amount of looping and matching thanks to how the model neatly returns result sets. CodeIgniter, unfortunately, comes with basic database helper functions that require you to still write most of the queries in SQL. Symfony uses rather complicated criteria syntax to set find conditions in the model layer that only marginally improve upon PHP's database functions. And Zend Framework relies almost entirely on your knowledge of SQL syntax to use its database adapter classes. Because Cake's find methods are designed independently of a data source, they don't have to follow a specific query language, which makes running finds through the model much easier.

CodeIgniter

CodeIgniter's community is relatively small when compared to CakePHP but does have a good support network online. Its user guide (www.codeigniter.com/user_guide) is well designed and has a nice layout for navigating through the table of contents. Many of the concepts used by Cake are also used by CodeIgniter, such as the MVC structure, helpers, routing, scaffolding, and caching. The support network is great, with a forum that boasts more than 66,000 topics and more than 400,000 posts. However, a lot of the topics there aren't directly related to code development issues like Cake's discussion group. In a sense, CodeIgniter's forums and wiki are more like combining Cake's discussion group, Bakery, and CakeForge. The number of web sites built on CodeIgniter is smaller than that for Cake, but CodeIgniter is off to a good start and will likely become a more popular framework in the future.

____________

2. When compared to other frameworks using Google's Trend History tool (www.google.com/trends). Of the PHP frameworks, CakePHP is searched the most.

Starting a CodeIgniter application takes less time than setting up a Cake application; however, some configuration methods that come preinstalled with Cake are left out with CodeIgniter. For example, setting up routes to behave like they do in Cake will require that you manually write an .htaccess file to pass paths through a similar routing engine. By default, CodeIgniter is more lightweight than Cake, which is one of its chief selling points. However, as you expand your CodeIgniter application, expect to have to perform an extra step here or there to achieve the same functionality you get from Cake.

The MVC structure in CodeIgniter is similar to Cake's. Because of this, the general process of creating models, views, and controllers is nearly identical to what you learn when building Cake applications. Aside from minor differences in passing data around the application and naming conventions, running CodeIgniter is largely the same experience as in Cake. However, where Cake wins is with its powerful core classes, helpers, routes, and data-handling methods. The available resources and built-in functionality are more robust in Cake and, frankly, more cohesive. In other words, Cake developers will probably think they have taken a step backward when fully immersing themselves in CodeIgniter, though they will undoubtedly think they are in familiar territory. That's not to say that CodeIgniter isn't already a fabulous framework; it's just that it separates methods into its several resources less effectively than Cake. In a nutshell, the Cake paradigm is more about making the model fat and spreading out the various methods; CodeIgniter makes for very large controllers.

Symfony

Symfony entered the PHP frameworks arena early on and has remained popular. Its community is also large with developers groups, forums, a chat room, a wiki, and more. All of the main links to these various online groups and sites are available on Symfony's community web page (www.symfony-project.com/community).

Symfony actually is much different from CakePHP in its approach. In this book, I showed how to create a Cake project by renaming a folder and placing it on your server or localhost. In Symfony, you learn important commands that you run through a Symfony console script, much like using Bake. You can install Symfony manually by downloading a packaged file and configuring its files to work with your server, or you can use PEAR to have an installation script handle most of the work for you. I find that getting Symfony to work correctly generally requires more time than Cake, simply because so many steps are required for both the server and the console to work right with the whole framework. But once these configurations are in place, starting a new Symfony application is as simple as entering a one-line command.

After you have successfully begun a Symfony application, you will need to initialize your data source connections using the command line as well as perform other setup tasks. Generating the scaffolding is also done in the console, but the final result is similar to Cake's scaffolding. Building models is primarily done using YAML-based configurations together with the symfony console script. If you prefer YAML to JSON or XML for configuring your database schema, then Symfony will probably suit you well. Cake really doesn't compare in this regard because its methods for connecting to a data source don't involve the command line (even though you can use Bake to write your database.php configuration file and build models).

When extending the Symfony application to take on more methods, many of the same concepts that make Cake effective are used. The learning curve is steeper when going from Cake to Symfony, mainly because the benefits Symfony offers are usually found in its command-line interface. However, Symfony users shouldn't find learning Cake all that difficult. It may take some getting used to running fewer commands in the console, but on the whole, you shouldn't have to perform any more steps to build your Cake applications than you would expect for a Symfony application.

Zend Framework

Zend Framework was arguably the first framework to be built for PHP. Its corporate sponsor, Zend Technologies, has a long history with the PHP language itself; its founders include two of the original authors of PHP, Andi Gutmans and Zeev Suraski. Much of what has made PHP one of the most popular web programming languages started with Zend Technologies and its contributions to the language. That being said, no wonder Zend Framework has had early success and continues to be a major player in the PHP frameworks market.

In terms of community support, Zend Framework has probably the largest online following of any of the PHP frameworks. Its documentation is extensive and thorough, and unofficial blogs and forums make it possible to get online support for just about any question. Code submissions to the core are passed through rigorous testing methods, which makes Zend Framework an incredibly robust framework. However, Zend Framework is much more of a large set of libraries than a lightweight MVC framework. For instance, its main library folder is almost 16MB, more than three times the size of Cake's libraries. Getting Zend Framework off the ground requires much more customization and configuration, whereas Cake has adopted more of the "convention over configuration" paradigm. You could likely use Zend Framework with just about any PHP project, which I demonstrate in Chapter 12 when explaining how to use Zend libraries in Cake, but the trade-off is that you'll have to write or at least configure much of what Cake does automatically with its dispatcher methods.

Zend Framework has no single development paradigm like Cake, CodeIgniter, and Symfony, and that appeals to many developers. Patterns like MVC are therefore possible in Zend Framework, but these require you to manually write configuration methods, which are automatically built into Cake and other frameworks. Cake is certainly ahead of Zend Framework in how the framework cuts down the amount of code needed to extend it. Learning Zend Framework is generally more time-consuming than learning Cake, mostly because of the design of the framework. Getting an MVC variant of Zend Framework off the ground is usually more difficult for a beginner than Symfony, not to mention Cake.

True, Zend Framework is more well known than Cake in most PHP circles; it's the veteran on the team, if you will. But Cake is proving to be more like the rising star that moves faster and is strategically sounder. Given Cake's effective implementation of the MVC structure and its structural design, it will likely continue to attract former Zend Framework developers and remain the top player in the PHP frameworks arena.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.212.196