Fabulous PHP frameworks: CakePHP

CakePHP combines easy installation with command-line tools that jump-start development

CakePHP, a product of the Cake Foundation, successfully walks the line between large frameworks (such as Zend) and small frameworks (such as Lithium). CakePHP's documentation claims that the framework requires no configuration. The CakePHP website gushes, "Set up the database and let the magic begin." This is a bit colorful, but not too far from the truth. The framework also features excellent command-line tools that dramatically reduce the time required to build an application. The current stable release, Version 1.2.9, requires at least PHP 4.3.2. 

As with other frameworks, CakePHP defines a strict directory structure, with equally strict rules regarding which files go in which subdirectory. This is referred to as "convention over configuration" and is in keeping with the framework's "no configuration" claims. You don't modify a configuration file to specify the location and function of files, classes, or methods; rather, you place specific elements in predetermined locations within the project. For example, all the library code is kept in the /cake subfolder of an application directory, and documentation expressly states that you must swear an oath not to modify the files in that directory. The directory structure also distinguishes between first-party libraries and third-party libraries, which helps you keep your corporate libraries separate from those acquired from the outside.

The convention over configuration principle carries through to framework entity names. Model classnames must be singular and camel-cased. For example, a model that manages music albums might be represented by a class named MusicAlbum. Table names corresponding to CakePHP models are plural and underscored, so our table for the MusicAlbum model would be music_albums. CakePHP even provides a utility library for pluralizing names to assist in the process.

To continue reading, register here and become an Insider. You'll get free access to premium content from CIO, Computerworld, CSO, InfoWorld, and Network World. See more Insider content or sign in.

This story, "Fabulous PHP frameworks: CakePHP" was originally published by InfoWorld.

ITWorld DealPost: The best in tech deals and discounts.
Shop Tech Products at Amazon