In the month of May, CakePHP team came up with the launch of the CakePHP3. Now with the Cake development team considering version 3 to be a game-changer, its release has certainly made many faces grin. Here we discuss how CakePHP 3 will turn to be an effective modern framework for PHP development.
A Brief History
Nowadays with PHP development, you come across various options. Over time PHP has matured and this way it welcomed many PHP Frameworks that offer developers many choices. However, had it always been this way?
Way back in 2005 PHP 4 was yet the standard and at that time there were no PHP frameworks thus the development of an object-oriented coding approach in PHP was just not easy. At that time CakePHP came to the fore with its first-ever PHP MVC framework. In the past decade since its release, CakePHP is continually evolving and it maintains a healthy share of PHP developers.
Its popularity can be accessed from the fact that it ranked in the top 4 most prominent PHP projects on GitHub, with over 130,000 projects with around 18,000 members in the CakePHP Google Group with 32,000 topics. There were 270 contributors to the code with 320 contributors to the documentation and hence proved that CakePHP was immensely prominent.
So here we endeavored to explore what’s with version 3 of the framework that’s now available. It will certainly lead in the PHP world and proves to be a major contender among today’s varied landscape of PHP frameworks.
What’s new in version 3 of CakePHP?
CakePHP 3.0 is integrated with various new features and enhancements, such as:
- Better performance. Version 3 is integrated with performance improvements to the bootstrap process, the routing process, and several parts of the process that generate helper templates.
- Enhanced components and helpers. Version 3 offers enhanced support for “flash messages” with its new FlashHelper and Flash Component. There is also CookieComponent that allows easy separation of the configuration of cookie namespaces and handling of cookie data.
- Improved session management. Session management was a static class in CakePHP that is quite troublesome in various ways. So now with version 3, it’s easy to access the session from the request object $this->request->session(). This way session can be tested easily and enables CakePHP to use PHPUnit 4.x.
- Enhanced consistency of conventions. The application skeleton and plugin skeletons are enabled to use the same directory structure so it’s more consistent with one another.
- Themes and plugins merged. With CakePHP 3, themes were more powerful and robust. As well as you needed the theme to have the same capabilities as plugins. This way any plugin can be used as a theme, thus simplifying packaging and redistribution.
- ORM Improvements. There have been various changes to the ORM (Object-relational mapping) and so it’s easy to state deep associations in order to save operations and various conventions have altered to lessen the learning curve and perplexion among new adopters.
There will also be some other features to be integrated into the beta release of version 3.0, such as:
- Internationalization and localization (i18n and L10n) feature enhancements
- A replacement for CacheHelper based on Edge Side Includes
- A new routing API for simpler and faster route declaration
Hence, version 3 signifies a major upgrade beyond prior versions of CakePHP.
Meanwhile, the vital features that actually set CakePHP apart are:
- Convention over configuration
- CakePHP’s ORM (Object-relational mapping)
- Components and helpers
Now with the advantages, every framework also deals with the common criticisms, such as:
- Legacy framework; bloated and slow
- Overly strict and confining
- Slow-release cycle
- Doesn’t offer out of the box solution
- Uses data arrays rather than objects.
- Poor documentation
With the launch of CakePHP 3, it’s clear that both PHP and CakePHP will continually grow and you are on a search for a PHP-based solution that offers several benefits similar to Ruby on Rails (in terms of ease-of-use and convention over configuration), then give CakePHP comes around as the best.