CakePHP 3.x Tutorial for Beginners Basics

CakePHP 3.x
CakePHP 3.x
CakePHP 3.x

CakePHP 3.x

CakePHP is an open source web development PHP framework running on PHP 7 (minimum required PHP 5.5.9). CakePHP completely follows MVC structure i.e. Module View Controller approach to build web based applications quicker with lesser code. Structure of CakePHP 3.x has released with some updates. This tutorial on CakePHP 3.x will provide you a basic step wise start up introduction along with installation.

CakePHP is designed to make tasks related to web development simpler, & easier than before. The main goal of this tutorial is to introduce the basic concepts in CakePHP, & to provide you all a quick overview on how the concepts in CakePHP are implemented.

Our step by step approach of CakePHP 3.x tutorials helps beginners to learn CakePHP from ground zero to master level. We know you are very excited to get started up with the CakePHP and that’s why you are here, so let’s get started up with the CakePHP 3.x.

CakePHP is very simple & easy to install. Minimum requirements are –

  • Web Server For example: Apache having mod_rewrite is recommended
  • PHP 5.5.9 or greater inclusive of PHP 7
  • PHP extensions mbstring & intl
  • Copy of CakePHP

CakePHP will run on variety of web-servers like nginx, LightHTTPD, or Microsoft IIS.

Note: In both WAMP and XAMPP, mbstring extension is working by default.

In XAMPP, intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel.

CakePHP 3.x can be installed by using 2 ways –

  • By downloading source-code from Git-Hub
  • By using composer

Installation with source code from Git-Hub

Step 1: Download pre compiled release of CakePHP 3.x source-code from Git-Hub

Step 2: Make sure that all the requirements have been met successfully. mbstring, intl should be enabled.

Step 3: Extract the zip folder which you have downloaded from Git-Hub, change the folder name with your desired project name. For example: CakePHP_Project

Step 4: Move the CakePHP_Project folder to the local server. Now the directory structure would look like as below mentioned:

File Structure CakePHP 3.x

File Structure CakePHP 3.x

Step 5: Open browser window and type “localhost/CakePHP_Project” to run the application. As you have not configured the Database yet so the output will look like as below –

CakePHP 3.x Installation output without databse

CakePHP 3.x Installation output without database

Step 6: Open “localhost/phpmyadmin” in browser, create database with a name “cakephp”.

Step 7: For database configuration with CakePHP 3.x, open up “CakePHP_Project/config/app.php” file and replace the values in the Datasources.default array with database details. After changes configuration array might look like as below –

'Datasources' => [
        'default' => [
            'className' => 'Cake\Database\Connection',
            'driver' => 'Cake\Database\Driver\Mysql',
            'persistent' => false,
            'host' => 'localhost',
            'username' => 'root',
            'password' => '',
            'database' => 'cakephp',
            'encoding' => 'utf8',
            'timezone' => 'UTC',
            'cacheMetadata' => true,
            'log' => false,
            'quoteIdentifiers' => false,
        ],
 ]

Step 8: Finally Run the application URL (http://localhost/CakePHP_Project/) at the browser, screen would look like the below.

CakePHP 3.x Installation output with databse

CakePHP 3.x Installation output with databse

 

You may also like...

Leave a Reply