At present, CakePHP is one of the widely used web frameworks. In addition to being written in PHP, it supports simplifies development of large and complex web applications by supporting model-view-controller (MVC) programming paradigm. The PHP 7 web framework further provides built-in features to simplify common web development tasks like database access, caching, authentication, validation and translation. PHP Developers always keep a track on CakePHP releases and new CakePHP features which comes along with the releases.
Likewise, the built-in security tools provided by CakePHP help PHP developers to prevent security threats like form tampering, SQL injection, cross-site scripting (XSS) and cross site request forgery (CSRF). The CakePHP core team has been upgrading the PHP framework consistently to simplify and accelerate custom web application development. In August, the CakePHP core team released CakePHP 3.5 officially after releasing two candidates.
The updated version of the PHP framework comes with several new features to accelerate custom web application development and make programmers productive. At the same time, it marks certain CakePHP feature and methods as deprecated which will be removed at the time of releasing CakePHP 4.0. The PHP developers must take advantage of the new features and improvements provided by CakePHP 3.5 to accelerate development of custom web applications.
Overview of Important CakePHP Features and Enhancements in CakePHP 3.5
Scoped and New Middleware
The new middleware added to CakePHP 3.5 makes it easier for PHP developers to apply encrypted cookies and cross-site request forgery (CSRF) tokens. At the same time, the programmers also have option to build specific middleware stack for different parts of the web application. They can even apply middleware conditionally to routes in specific URL scope. CakePHP 3.5 even allows them to build middleware stack without writing URL checking code.
Cache Engine Fallbacks
The enhanced CakePHP features allows CakePHP developers to configure cache engines with a fallback key. The programmers can define custom cache configuration through the fallback key. If the cache engine is not unavailable or misconfigured, the cache engine will automatically fall back on the custom cache configuration defined through the fallback key.
Improved Console Environment
The updated version of CakePHP enables PHP developers to build web application in an improved console environment. The web developers can integrate the application class into the command-line interface (CLI) environment using a new console dispatcher provided by the framework. They can further accelerate console commands testing by taking advantage of integrated testing helpers. At the same time, CakePHP 3.5 suggests valid options to PHP programmers through missing options and subcommands.
CakePHP 3.5 comes with two new classes – Cookie and CookieCollection. These new classes enable PHP developers to work with cookies in an object oriented way. At the same time, the developers can access the classes while working with Cake\Http\ServerRequest, Cake\Http\Response, and Cake\Http\Client\Response.
Built-in dotenv Support
The version 3.5 of CakePHP makes the application skeleton support dotenv natively. While using CakePHP 3.5, programmers can take advantage of a robust zero-dependency module like dotenv to work with environment variables more efficiently. Dotenv further makes it easier for PHP developers to configure applications using environment variables, while keeping the configuration and code separated.
CakePHP 3.5 also comes with new methods related to console, collection, database, datasource, event, ORM, routing, validation, testsuite, and view. The new methods enable PHP developers to work with various components of CakePHP more efficiently. They can even use the new methods to accomplish varying web development tasks without writing additional code.
The PHP developers can easily upgrade to CakePHP 3.5.0 by running a simple composer command. But the latest version of CakePHP does not support certain methods. For instance, it requires programmers to use separate get/set methods instead of combined get/set methods. Hence, it becomes essential for PHP developers to know these deprecated methods and their replacements. The web application developers can further refer to the CakePHP 3.5 Migration Guide to upgrade to the latest version of the popular PHP framework smoothly.