PHP Web App Frame work
Problem Description :
Explanation of the web app frame work
Resolution :
The Symfony frame work is based on the Model/View/Controller pattern and all file can be broken into those three categories.
The framework itself 4 key folders
config - this folder contains the routes (URL to controller mappings) and services for an application
src - this folder contains all of the PHP classes that make up the models, data accessors, controllers, and events
vendor - contains all third party libraries the frame work needs
web - contains all of the web templates
Creating a new app
When you create a new app, you must copy an existing on, and then change the application in the /config/application.yml file to match the root folder name of the app.
Adding a route
Then create your routes under the /config/routes/route.yml file. Each route must be in the following format:
exampleRoute:
path: /example/path
defaults:
_controller: 'Gordon\MVC\Controller\exampleController::exampleFunction'
The name of the route should be named according to the business need. The controller and function will be the function executed when that URL path is accessed. THE ROOT APP FOLDER DOES NOT NEED TO BE INCLUDED IN THE PATH. So for instance, for the FORGE login route of www2.gordonstate.edu/forge/login, the path in the route only needs to be /login. The root folder will automatically be interpolated into the url by the framework.
login:
path: /login
defaults:
_controller: 'Gordon\MVC\Controller\loginController::serveLogin'
Adding a controller
Then build the controller class that should be used to handle the route. Copy a controller, clean out the old logic, and add the new logic you need.
Revision Date : 11/26/2019