Obejctive : initialize the docker containers
Execute the following command to initialize the project :
docker compose up -d --buildComposer is the package manager for PHP. It is used to download bundles and libraries other developer made and to set up our own php project. We will use it for the PSR-4 autoloader it brings.
docker compose exec php-framework composer initObjective : set up the redirections.
The purpose of a router is to manage all the incoming requests from clients and redirect them to according functions, in dedicated files. Therefore, we need a single entrypoint for all the requests. We are using a .htaccess file for that.
Objective : get the requests informations
Objective : move the request informations in a dedicated class
Objective : setup the config to list all the routes the application will handle, and what controller will process them
Objective : We want to check if the URI matches something in our route config, and if so we can have a controller name
Objective : move the router loop inside a dedicated class, and extract sub-functionnalities into dedicated functions
Objective : use the router to call a controller class according to the route config
Objective : use polymorphism and abstract class to provide a safe and reusable template for the controllers. Move the logic from index.php into the router
Objective : create a universal response object all controllers must return