CakePHP 4 Tutorial for Beginners Part-1

Webs Codex
2 min readSep 22, 2020

--

Cakephp 4 for befinners

CakePHP is an open source web application framework. It follows the Model-View-Controller (MVC) approach and written in PHP. CakePHP makes building web applications simpler, faster and require less code.

This CakePHP tutorial will drive you to the right direction for getting started with CakePHP framework and provide basic guide of CakePHP application development. Our step by step CakePHP tutorial helps beginners for install and configures the CakePHP application. You can learn CakePHP from scratch with our easy tutorial. Also we will develop a sample CakePHP project and it will help you for better understanding the whole process.

Application flow of the CakePHP are given below:

Installation CakePHP 4

Before starting, you need to make sure that your PHP version is up to date:

You must have PHP 7.2 higher. The PHP version of your web server must be at least 7.2 or higher and the same version that the command line interface (CLI) uses.

You can create a new CakePHP application using the create-project creator command:

Hit this command in command prompt and download CakePHP 4 in our xampp\htdocs directory and change folder name with your desire project name.

Step-1 Create database at the localhost/phpmyadmin. For example blog_database.

Step-2 Open the “config/app_local.php” file and make the following changes.

Go to the Datasources section and replace the value of host to localhost, username to root, password to our blank if you have and database name.

Step-3 Run the project URL http://localhost/cakephp4/ at the browser

CakePHP Naming Conventions

Model Convention: Model class names are singular Camel Based Admin and Product

Controller Convention: Controller class names are plural, Camel Based and end in Controller

as ProductsController, AdminsController

View Convention: The template view files are named in the controller function, which are shown in underscored form. The index() function of the ProductsController class looks for a view template in template/Products/index.php. The base model is src/Model/Entity & Table/Product.php & ProductsTable.php.

https://www.webscodex.com/2020/09/cakephp-4-tutorial-for-beginners-part-1.html

Originally published at https://www.webscodex.com on September 22, 2020.

--

--

Webs Codex
Webs Codex

Written by Webs Codex

Webs Codex is programming and web development blog

No responses yet