In this post i am going to explain how to setup cakePHP latest version. If you are new to cakePHP then this post help you to setup cake in your local server. Later i am going post series of cakephp tutorial to cover some basic functionality.

Official Site: http://cakephp.org/

Requirements for cakephp v3

  1. Composer
  2. PHP 5.5.9 or greater
  3. Mbstring PHP extension
  4. Xampp/Wamp  latest version [i am using XAMPP V3.2.2 for this example.]

Step 1. Open XAMPP Control Panel start Apache and MySql. Now click on shell and type bellow command in your shell.

and download & install Composer, a dependency management tool by running simple command on xampp shell  i.e.

CakePHP V3 installation

Step 2. After successful installation of composer,  All we need to create new project by running command on shell  i.e

I have named my project as mycake, Using the above command our project is created in htdocs folder and  all dependencies required for project are downloaded automatically.

CakePHP V3 installation using shell

Step 3. After dependencies install we are asked to set folder permission. Just type ‘Y’ and press enter and give permission.

Now we have successfully installed cakephp v3 on xampp. Open download location where you install your CakePHP.  In CakePHP V3 folder structure  is different from older versions.

Setup Database connection in your cake

To connect our project with database  go to \xampp\htdocs\mycake\config, Look for app.php inside this folder and add your connection in it as shown below

After make change save file and open your browser and type your project URl: http://localhost/mycake . If cake is successfully installed and database connection is setup you see this screen.

CakePHP is ready to bake

CakePHP Folder Structure

After you successfully install CakePHP these are the files and folders you should see:

  • bin  :- this folder holds the Cake console executable.
  • config :- this folder contain cake configuration file like Database connection, email config, Routes, bootstrapping etc.
  • logs :- Contain logs file
  • plugins :- Contain plugin for your project
  • src :- Contain your application files, Main logic of your project, Model View Controller etc.
  • tests :- in this folder where you put the test cases for your application.
  • tmp :- Store temporary data.
  • vendor :-  folder is where CakePHP and other application dependencies will be installed. Don’t make any change inside this folder :-p
  • webroot :- here you can place your CSS, JS, Images etc. All those thing which publicly access.
  • .htaccess 
  • composer.json
  • index.php
  • README.md

Hope this help you to setup your cake. Stay tune i am going to post some more useful topics on cakePHP.