CakePHP is a MVC Framework written in PHP. The major difference between 3.0 and 2.0 version of CakePHP is 3.0 is object oriented (uses class and objects). It has lots of features which can be used in fast development with less code and builds complex applications faster than plain PHP.
It need Composer which is a Dependency Manager for PHP. Install Composer first in your desired directory with command-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
Now You have composer.phar in your directory.
Make sure you have Apache Server, PhP 7.2 , and mbstring PHP extension , intl PHP extension are enabled in php.ini file.
Run this command - php composer.phar create-project --prefer-dist cakephp/app my_app_name
It will create lots of files and folders of cakephp framework,in vendor folder one is autoload.php which automatically loads all the files of framework.
- bin - it handles console commands
- config - configuration of our application
- app.php - setup database , email configuration.
- bootstrap.php - components of our app
- routes.php - specifies the routes in our app
- logs - contains logs file generated by app.
- plugins - it has plugins stored of the framwork.
- src - It is the main directory. It has Controller, Model , View , (Templates) where we will write our code most of the time.
- vendor - this is created by composer which have framework files.
- webroot - This is the root folder. It has css, img, js files.
The webServer first get into .htaccess which makes flow of program to webroot folder from there it spread to other part of our app.
change directory inside your App folder
run command - bin/cake server
That's it. Your Server is ready on localhost:8765