View Code? Open in Web Editor
NEW
learning MVC arhitecture using PHP
mvc's Introduction
Building MVC framework with PHP
d-App
d-Controllers
d-Admin
d-Views
d-Models
d-Core
l-Dispatcher
l-Controller
l-View
d-public
.htaccess
l-index.php
d-vendor
Routing: how URLs are processed in n MVC framework
- Create a central entry point to the framework: the front controller
- Configure the web server to have pretty URLs
- Get the controller and action from a URL with a variable structure, using regular expression
- Dispatch the route: create the controller object and run the action method
- Load classes automatically: add namespaces and an autoload function. (with composer)
- Remove query string variables from the URL before matching to a route
- Action filters: call a method before and after every action in a controller
- Display a view: create a class to render views and use it in a controller
- Make views easier to create and maintain: add a template engine (with Twig)
- Remove repetition in the view templates: add a base template to inherit from
- Add a model, get data from the database and display it in a view
- Optimise the database connection: connect only on demand and reuse it
Manage code using Composer
- Install the template engine library Twig using Composer
- Include all package classes automatically using the Composer autoloader
- Replace the autoload function with the Composer autoloader
- Put application configuration settings in a separate file
- Handle errors: convert errors to exceptions and add an exception handler
- Handle errors: convert errors to exceptions and add an exception handler
- Categorise different types of error using HTTP status codes
- Add views to make error pages look nicer for users
mvc's People
Contributors
Watchers