Question about MVC folder structure

To use the structure of the MVC template / layout, is everything needed at all that needs to be loaded through 1 file, for example, your index file?

+1
php model-view-controller
source share
2 answers

Not. The MVC pattern only dictates the separation of issues related to event / request processing, data modeling, and the user interface. The implementation method is not specified.

Many (all?) Of the existing PHP frameworks that I know of use a single entry point (index.php) and a route from there. This often uses the "Front Controller" pattern.

Another method (using a separate PHP file per page) is known as the Page Controller template. The advantage of this is that it is much simpler, but it loses the application control provided by the front controller and may be prone to code duplication.

+3
source share

Not. Nothing in the MVC template alone says anything about how your files or folders should be organized. However, the structure you are using may indicate a specific agreement.

+1
source share

All Articles