A PHP application, creating a simple MVC-Framework, where routing is base on the Controller name and Method name.
Directory Structure:
- app
- assets
- images
- libraries
- scripts
- styles
- scripts
- styles
- config
- Bootsrap.php
- config.ini
- controllers
- libraries
- models
- public
- views
- assets
Where:
- assets - lits of all styles, scripts and images
- config - where the application configuration resides
- config.ini - is where you set you database credentials
- controllers - where all application controllers resides
- libraries - where all utilities and helper classes resides
- models - where all application models resides
- public - where all external documents e.g. upload iamges, pdf and etc. resides
- views - where all the html templates resides
- Download Docker (version used: 18.09.1)
- Pull the source code
- cd path/to/blogs/
- open your fav command line
- run: docker-compose build
- run: docker-compose up -d
- after successfully creating the containers, access the application with this address: localhost:5000
- Create a controller e.g.
MySampleController.php
inside apps/controllers/ (please check the existing controllers for the structure) - Inside MySampleController.php create an action method e.g.
public function indexAction() {}
(please check the existing controllers for the structure) - Your controller can be access in the browser with the url format:
localhost:5000/<my-sample>/<index>