How to install CakePHP 4 Framework

CakePHP is a widely used PHP framework for small and large-scale projects. It is based on the MVC (Model View Controller) architecture which makes the development process easier if you are familiar with it.

It requires composer for installation.

In this tutorial, I show how you can install CakePHP 4 in your system.

I am assuming you have already installed composer. If not then you can follow this link.

How to install CakePHP 4 framework


Contents

  1. Server requirement
  2. Create a Project
  3. Start development server
  4. Output
  5. Conclusion

1. Server requirement

  • Minimum PHP version it requires is 7.4.
  • The following extensions need to be enabled – mbstring, intl, SimpleXML, and PDO.
  • It supports the following database storage engines –
    • MySQL (5.6 or higher)
    • MariaDB (5.6 or higher)
    • PostgreSQL (9.4 or higher)
    • Microsoft SQL Server (2012 or higher)
    • SQLite 3

2. Create a Project

  • Navigate to the htdocs using the Command prompt or terminal depending on your system –
composer create-project --prefer-dist cakephp/app:~4.0 cakephpproj
  • Here, cakephpproj is the project name. Change it while running the command.

CakePHP 4 project structure


3. Start development server

  • Navigate to the created project using the Command prompt if you are on windows or use the terminal if you are on Mac or Linux.
  • Run the following command for Mac and Linux –
bin/cake server

Run CakePHP 4 project

  • If you are on Windows –
cd bin/cake
cake server

Start CakePHP 4 development server in Windows

  • Change port –
bin/cake server -H 127.0.0.1 -p 3421

or

bin/cake server -H localhost -p 3421
  • Run the command in your browser.

4. Output

It will give the following output if the project runs successfully.

CakePHP 4 project


5. Conclusion

I hope this tutorial helps you to set up your first CakePHP 4 project.

If you found this tutorial helpful then don't forget to share.

Leave a Comment