CakePHP Interview Questions and Answers
CakePHP is a modern, open-source PHP 7 framework that makes building web applications simpler and faster. It is based on MVC architecture that is powerful and quick to grasp. The in-built models, controllers, and views allow natural separation of logic from presentation layers. This framework requires less code and offers a flexible database access layer with a powerful scaffolding system. A lot of CakePHP interview questions were asked about the basic overview.
Advantages
- Build apps quickly
- Complicated XML and YAML files not required.
- Ideal for making commercial apps.
- Secure, scalable and stable
- Unique built-in features like translation, caching, database access, and authentication.
Here are some of the CakePHP Interview Questions for freshers as well as experienced candidates:
Development History
Michal Tatarynowicz, a Polish programmer, started CakePHP in April 2005. The framework got published under the MIT license. L. Masters and G. J. Woodworth founded the Cake Software Foundation in Dec 2005 to promote the development of CakePHP and released Version 1.0 in May 2006.
Latest Version: Version CakePHP 3.7.2 got released in Jan 2019.
Top CakePHP Interview Questions
$this->layout ="layout_name";
You can use this in your controller's action.
$this->set(compact())
to pass multiple parameters to access into the view file.$this->set(compact('variable1','variable2','variable3'));
<?php echo Router::url( $this->here, true ); ?>
Yes, we can use ajax with by calling ajax helper.
Default extension of view file is ".ctp"
.
We can change default extension to write public $ext = '.yourextension'
in AppController. If you want to change it for particular controller then please add it into that particular controller only. You can also change it for the specific action of the controller by putting it in that action only.
- APCu
- File-Based
- Memcached
- Redis
- Wincache
- XCache
To set a custom page title, copy & paste following code anywhere in your (.ctp) file.
$this->set("title_for_layout", "Home Page | bestinterviewquestion.com");
- It improvements it's ORM feature.
- It enhanced components and helpers
- Best proficiency in cakePHP3
- It improved session Management in cakePHP3.
- It improved consistency of conventions in cakePHP3
- It improved bug-fixing tool in cakePHP3
Component : It is a Controller extension in cakePHP.
Helpers : Helpers are View extensions in cakePHP.
Behavior : It is a Model Extension in cakePHP
It's default file name is database.php.default. We can use this file to configure with database. This file is located in "/app/config/database.php.defaut"
.