Getting started with CakePHP 2.2.5

Hi, currently i am developing a new application using Cakephp. As it is my first development using cakephp framework i fall in some difficulties working with it. I am writing this tutorial in hope that you can configure & run the first page smoothly. I will try to write some more tutorial for intermediate cakephp developer later when i just get enough experience on it. The first thing we need to remember is that Cakephp is a PHP framework that follows the Model-View-Controller standard, which helps developer separate the application layers quite nicely.

Currently MVC convention is becoming a more and more common concept, especially about web applications. We can also point out that Cakephp also follows the Convention-Over-Configuration methodology, which can greatly reduce the amount of code you have to write. Let’s deep to the steps:

Step1: Firstly, create a Database (for example we use tutpub_database). We can do it later, but we did it first so that we can concentrate on the cake.

Step2: Download the cakephp package from cakephp.org. Create a folder (rename it to tutpub_cakephp) in your server directory. Unzip the cakephp package & copy all files & folder to the tutpub_cakephp folder.

Step3: Now its time to change the database configuration information. Go to “/tutpub_cakephp/app/Config/” & rename the “database.php.default” to “database.php“. Open the database.php file and update the “$default” array in “DATABASE_CONFIG” class. For example I have update as follows:

Now you can point out the project folder in your web browser. It is showing that all configuration is in green (nicely done). Now we will create a model, a controller, & a view to view a “hello world” page.

Step5: Go to “/tutpub_cakephp/app/Model/” directory and create a php file with the name “Test.php“. Then put php code below:

<?php
class Test extends AppModel {
}
?>

Step6: Go to “/tutpub_cakephp/app/Controller/” directory and create a php file with the name “TestController.php“. Then put php code below: