Skip to main content

CakePHP

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier.

It is based on the concept of MVC architecture, which helps to build PHP web applications easy and simple with less code. CakePHP also helps you to separate business logic from data layer and presentation layer.

History of CakePHP

In 2005, Michal Tatarynowicz wrote a minimal version of a Rapid Application Framework in PHP and found that it was the start of a very good framework. Michal published the framework under The MIT license, dubbing it Cake, and opened it up to a community of developers, who now maintain Cake under the name CakePHP.

CakePHP Features

  • MVC ready, out of the box!
  • Built for rapid application development
  • Composer based installer
  • Code generation and scaffolding tools
  • Convention over configuration design
  • Secure by default, with built-in security
  • MySQL, Postgres, MSSQL and SQLite
  • Full database abstraction through models
  • Extensive i18n and l10n support
  • Powerful routing for SEO and SEM
  • Flexible view templates system
  • Includes support for caching engines
  • Fully extensible with custom plugins
  • Support for 3rd party vendor libraries
  • Open sourced under the MIT license

CakePHP request cycle

The typical CakePHP request cycle starts with a user requesting a page or resource in your application. At a high level each request goes through the following steps:

The webserver rewrite rules direct the request to webroot/index.php. Your Application is loaded and bound to an HttpServer. Your application’s middleware is initialized. A request and response is dispatched through the PSR-7 Middleware that your application uses. Typically this includes error trapping and routing. If no response is returned from the middleware and the request contains routing information, a controller & action are selected. The controller’s action is called and the controller interacts with the required Models and Components. The controller delegates response creation to the View to generate the output resulting from the model data. The view uses Helpers and Cells to generate the response body and headers. The response is sent back out through the Middleware. The HttpServer emits the response to the webserver.

Why CakePHP?

There are some advantages of using CakePHP like :

Cake PHP is by far, one of the quickest web development platforms. CakePHP allows developers to gain enhanced control over the database and SQL queries. It helps users to develop robust web applications without losing their environment flexibility rapidly. Support for PostgreSQL, SQLite, MySQL, PEAR-DB for ADODB, a database abstraction library. Facilitates search Engine Friendly URLs Provide features like input validation and sanitization tools which make the app secure. Templating with familiar PHP syntax

Disadvantages of using the CakePHP framework

To use CakePHP software, the developer needs to update the default routes for creating fancy URL’s, which is a lot more work compared to other PHP frameworks. The documentation supports of CakePHP is not as comprehensive as it should be. CakePHP one way routing as compared to other frameworks. Learning PHP framework is not easy. Offers one-way routing is another disadvantage when compared with frameworks such as Ruby on Rails.