I have built a framework for my applications that has been working well, and I have always referred to it in my mind as an MVC. However, after reading some more on what an MVC is (not that I didn't to start with, but I gave it a very brief overview, and looked at other frameworks that used the mvc pattern), and it has given me pause for thought.
The structure is as follows:
The framework has a bootstrap that loads the required files for the framework and the initiation file for the application (
app_bootstrap.php file has three functions.
First, it creates constants for the framework to use (i.e. Database connection setup, profiling setup, base url path, and internal file paths).
Second, it requires all the files that would be pertinent to the application, primarily, what I have called "model" classes which contain information on the name and structure of tables in the database, validation rules, associations to other "models", etc. These "models" extend an abstract class that contains static functions for selecting and creating rows from the database, which will create instances of an entity class that deals with the row, such as
__unset for fetching columns and associations, and
delete for saving the row changes to the database.
Third, it calls functions within the
router.php file that will setup bindings for environmental data (like the url, user login status, ssl, ajax, cookie existence, etc) to "controller" classes.
The framework then runs an execution function within
router.php that will go through the defined environmental data rules, and determine which "controller" to load, if it finds one, it will
require the file (from the application/controllers directory, throwing an error if not found) and call the class with the appropriate entry point function (index is none defined), or throw a 404 error.
Once the "controller" has been started, there are no more functions that the framework will execute, and once the "controller" has finished, the program will end (unless the profiling has been activated, where it will output the data, then end). But the framework provides functions to the "controller", and to name a few, an
input class (for dealing with all input, such as
$_SERVER variables, cookies, user agent, remote ip, etc, as well as providing a sanitized interface), an
output class (for headers, cookies, status messages, etc), a
queryBuilder class (for creating queries to the database in the event functionality that can't be done within the "model"), and a
view class (for parsing variables into a view for rendering and returning to the client).
But after reading some more information on MVC's, it appears that the
router.php acts similarly to a Controller, the "controller" acts like the model, the "model" acts like an ORM, and the view is pretty much correct. So, would this framework still be classed as an MVC, or does it fit under another pattern (if there is such a pattern)?