Wednesday 25 April 2018

Cakephp Interview Questions

1.    What is Cakephp?

CakePHP is a free, open-source, rapid development framework for PHP. It’s a foundational structure for programmers to create web applications. CakePHP goal is to enable developers to work in a structured and rapid manner–without loss of flexibility. CakePHP takes the monotony out of web development.

2.   When CakePHP was developed?


CakePHP started in April 2005.When a Polish programmer Michal Tatarynowicz wrote a minimal version of a Rapid Application Framework in PHP, dubbing it Cake.CakePHP version 1.0 released in May 2006.  (source:http://en.wikipedia.org/wiki/CakePHP)

3. What is the current stable version of CakePHP?

3.4 (on date 2017-04-01).

4. What is MVC in CakePHP?


Model view controller (MVC) is an architectural pattern used in software engineering.

Model      : Database functions exist in the model

View        : Design parts written here
Controller : Business Logic goes here
MVC Architecture of CakePHP Server requirements for CakePHP.

Here are the requirements for setting up a server to run CakePHP:

An HTTP server (like Apache) with the following enabled: sessions, mod_rewrite (not absolutely necessary but preferred) PHP 4.3.2 or greater.

Yes, CakePHP works great in either PHP 4 or 5. A database engine (right now, there is support for MySQL 4+, PostgreSQL and a wrapper for ADODB).

5. How to install CakePHP?

step1: Go to cakephp.org and download the latest version of cakephp.
step2: Cakephp comes in a .zip file,so unzip it.

step3: Extract the files in the localhost in the desired folder (for example:cakephp).
step4: Open the browser and run the URL localhost/cakephp
step5: Just Follow the instructions display on the page.

6. What is the folder structure of CakePHP?


cakephp/

app/

Config/

Console/
Controller/
Lib/
Locale/

Model/
Plugin/
Test/
tmp/
Vendor/
View/
webroot/
.htaccess
index.php
lib/
plugins/
vendors/
.htaccess/
index.php/
README.md/

7. What is the name of Cakephp database configuration file name and its location?


Default file name is database.php.default. Its located at “/app/config/database.php.default”. To connect with database it should be renamed to database.php

8. What is the first file that gets loaded when you run a application using cakephp?can you change that file?

bootstrap.php
yes it can be changed.Either through index.php , or through .htaccess

9. What is the use of Security.salt and Security.cipherSeed in cakephp? How to change its default value?

– The Security.salt is used for generating hashes.we can change the default Security.salt value in /app/Config/core.php.
– The Security.cipherseed is used for encrypt/decrypt strings.We can change the default Security.cipherSeed value by editing /app/Config/core.php.

10. What are controllers?

A controller is used to manage the logic for a part of your application. Most commonly, controllers are used to manage the logic for a single model. Controllers can include any number methods used to display views. An action is a single method of a controller.

of methods which are usually referred to as actions. Actions are controller

11. What is default function for a controller?

index() function

12. Which function is executed before every action in the controller?

function beforeFilter()
List some of the features in CakePHP
  1. Compatible with versions 4 and 5 of PHP
  2. MVC architecture
  3. Built-in validations
  4. Caching
  5. Scaffolding
  6. Access Control Lists and Authentication.
  7. CSRF protection via Security Component.
Using cakephp, what all are drawbacks.
It loads full application before it starts your task. It’s not recommended for small projects

because of its resource-heavy structure.

13. What is the naming convention in cakephp?

Table names are plural and lowercased,model names are singular and CamelCased: ModelName, model filenames are singular and underscored: model_name.php, controller names are plural and CamelCased with *Controller* appended: ControllerNamesController,
controller_names_controller.php, controller filenames are plural and underscored with *controller* appended.

14. What is Scaffolding in Cakephp?

Scaffolding is a technique that allows a developer to define and create a basic application that can create, retrieve, update and delete objects.

15. How to add Scaffolding in your application?

To add scaffolding to your application,just add the $scaffold variable in the controller,
<?php
class PostsController extends AppController {
    var $scaffold;
}
?>
Assuming you’ve created Post model class file (in /app/Model/post.php), you’re ready to go. Visit http://example.com/posts to see your new scaffold.

More about CakePHP:

No comments:

Post a Comment