CakePHP Interview Questions and Answers
Freshers / Beginner level questions & answers
Ques 1. What is CakePHP?
CakePHP is a free, open-source, rapid development framework for PHP.
Example:
// echo 'Hello, CakePHP!';
Ques 2. How to create a new CakePHP project?
You can use the 'composer create-project' command to create a new CakePHP project.
Example:
// composer create-project --prefer-dist cakephp/app my_project
Ques 3. What is the purpose of the CakePHP 'Inflector' class?
The 'Inflector' class is used for pluralizing and singularizing English words, including class names and table names in CakePHP.
Example:
// Inflector::pluralize('Article'); // Returns 'Articles'
Ques 4. What is the purpose of the CakePHP 'Dispatcher'?
The 'Dispatcher' is responsible for dispatching requests in CakePHP, routing them to the appropriate controller action.
Example:
// Automatically handled by CakePHP
Ques 5. How to use custom table names for models in CakePHP?
You can set the 'table' property in your model class to specify a custom table name for that model.
Example:
// public $table = 'my_custom_table';
Ques 6. What is the purpose of the CakePHP 'Configure' class?
The 'Configure' class in CakePHP is used for configuration settings and managing application-wide settings.
Example:
// Configure::write('debug', 2);
Ques 7. How to use the CakePHP 'HtmlHelper' for generating HTML tags?
The 'HtmlHelper' in CakePHP provides methods for generating HTML tags. It helps in creating links, images, forms, and more.
Example:
// = $this->Html->link('Click me', ['controller' => 'pages', 'action' => 'display', 'home']) ?<
Most helpful rated by users: