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.
Contents
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.
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
- If you are on Windows –
cd bin/cake cake server
- 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.
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.