What exactly is a framework?
So what is a PHP framework? Essentially, it’s a set of PHP classes and functions that developers adhere to when developing a site. The MVC paradigm can be viewed as an extension to templating engines. Here is a quick explanation:
- Model: The model contains the server business logic code. This usually involves the reading and writing to a database in addition to some pre- or post-processing. For example: ‘A user enters a comment, but before we insert it into the database, we need to do a spam check with akismet.com; if it passes we can do the insert.’
- View: This is where you present the output to the user in a particular format, most often HTML markup, although it can be the JSON or XML format. For example: ‘We need to display all the comments for a forum topic, the model fetches all the comments and are then read and formatted by the view.’
- Controller: The controller is essentially the manager. It first intercepts the URL, then calls the correct models and views before presenting it to the browser, mobile device or an API caller. For example: ‘In displaying all the comments for a topic, the controller makes the actual call to the model and then passes the model data to the view, which then generates the HTML output. This generated view is then shown to the calling browser by the controller.’
I wish this finds you well, have been catching up on all of your before posts! Outstanding information!
ReplyDeleteJoomla Developers Bangalore | Joomla Website Development Bangalore