Ketan Patel    18-Sep-2014

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.

 

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)

 

What is the current stable version of CakePHP?


3.4 (on date 2017-04-01).

 

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).

 

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.

 

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/

 

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

 

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

 

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

 

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 of methods which are usually referred to as actions. Actions are controller methods used to display views. An action is a single method of a controller.

 

What is default function for a controller?


index() function

 

Which function is executed before every action in the controller?


function beforeFilter()

 

List some of the features in CakePHP


- Compatible with versions 4 and 5 of PHP
- MVC architecture
- Built-in validations
- Caching
- Scaffolding
- Access Control Lists and Authentication.
- 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.

 

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 filenames are plural and underscored with *controller* appended: controller_names_controller.php,  

 

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.

 

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.

 

What is a Component in cakephp?


Components are packages of logic that are shared between controllers. They are useful when a common logic or code is required between different controllers.

 

What are commonly used components of cakephp?


  • Security
  • Sessions
  • Access control lists
  • Emails
  • Cookies
  • Authentication
  • Request handling
  • Scaffolding

 

About Ketan Patel

A Web Developer having 7+ years of experience in web development. Worked with Laravel-Lumen, CakePHP, CodeIgniter, Opencart to make sites for startup companies and small businesses. Apart from blogging, he likes to read Novels, Listening music and Net surfing.