Up Arrow

Installation Process and Naming Convention of CakePHP (Part 1)

  • Date: August 2nd, 2013 | by wahid
  • Facebook
  • Tweet
  • Googleplus
  • IN

How to setup ::

Step 1 : Download cake php from http://cakephp.org and save it into php www directory and rename the folder to blog.

Step 2 : Create database table.

http://localhost/phpmyadmin/   –>   Create Database (Example : cake)  –>       Create Table under cake (Example : posts)

Step 3 : Now go to this directory localhost/blog/

Rename App/Config/database.php.default to App/config/database.php

Step 4 : Now You have to Open database.php –> Change host to localhost –> login (from user to root) –>

Password (from password to ‘ ’) –>        database (database_name to cake)

Step 5 : In this step open … /app/Config/core.php by editor and change red color text into alphanumeric  random string.

Configure::write(‘Security.salt’, ‘pl345e-P45s_7h3*S@l7!’);   and

Change red color text into random numeric string (all digits)

Configure::write(‘Security.cipherSeed’, ‘7485712659625147843639846751’);

Naming Convention ::

Rule 1: Database table name should be plural (example : posts)

Rule 2: Create a php file into app/models. File name should be singular form of database table name. (example : table name posts. So the file name is post.php)

Rule 3: Create a class inside post.php. Class name should be camel case.

Rule 4: Create a controller at app/controllers. Controller file name should be database table name_controller.php (our database table name is posts. So controller file name is posts_controller.php).

Rule 5: Create a class inside posts_controller.php. Class name should be camel case (PostController)

Rule 6: Create a action inside PostController class. Create a action by creating a function. (For example we create a function hello_world)

Rule 7: Create a folder inside app/views. Folder name should be same as controller file name without controller portion. (For example our controller file name is posts_controller.php. So we create a folder inside app/views and name it posts)

Rule 8: All action inside controller should have a view. Create a file inside app/views/posts. File name should be same as action name inside controller and the file extension should be .ctp (our action name inside controller is hello_world. So the file name inside app/views/posts is hello_world.ctp )

Recent Posts