Need guidance on the correct flow of my PHP MVC Framework

I am creating a PHP web application framework (MVC). I would prefer not to use external libraries or components (since I want this to be purely my work at the moment)

Can you tell me some tips / tricks on which each of my files should be responsible for execution? For example, what should be processed by the Framework script and what should be processed by the script application used within the framework?

I’m constantly changing the place of writing other code (as I think to myself ... "Should it be processed by the framework or by each application?"), Which makes it more confusing when I go.

I read a bunch (20 ... 50 ... 100 even!) Of tutorials on MVC, frameworks, etc., but not so much that explains the perfect "flow" of the structure.

I am currently working as follows:

  • Main index (index.php)
    • Defines constants (DS = DIRECTORY_SEPARATOR, PS = PATH_SEPARATOR, etc.)
    • Kits include paths (ROOT. '/ Classes', ROOT. '/ Includes', etc.)
    • Loads the configuration file for the Framework (config.php)
    • Sets the class autoloader class (__autoloader ())
    • Installs some kind of Core object (Core :: init ($ config)?)
    • Loads the application file index.php (app / index.php)
  • Configuration (config.php)
    • ($ config)
    • ($ config ['debug'] = 0... - ..)
  • (app/index.php)
    • (APP_CONTROLLERS, APP_MODELS ..)
    • (APP_PATH. '/classes', APP_PATH. '/includes' ..)
    • (app/config.php)
  • (app/config.php)
    • ($ app_config)
    • ( , , )

... , ? script, ? , .., URL- ..?? , Framework , ..?

, , / .. ( , ), , , .

- !

, , - , , - ! .

=)

+3
4

MVC , . , , .

, ... . , ?;)

+3

, , .

MVC, , , . , .

, , , , .

, , PHP MVC , .

, MVC, , .

, , , , .

, , , .. . , (), , , !

John Squibb MVC. http://johnsquibb.com/tutorials/mvc-framework-in-1-hour-part-one

, , , , mod_rewrite Apache. MVC .

, , , .

+4

mvc, , , . , , , , mvc (symfony zend), , . - , , mvc, Symfony, , symfony. Anant Garg Jobeet Symfony, symfony 1.4.

,

+2

It should be remembered that MVC is just a template, and therefore it should not be 100% strict, but rather a guideline for implementation, which can be changed according to your specific needs. So, as others have suggested, try what you have and you will see what works for you and what does not.

+1
source

Source: https://habr.com/ru/post/1752536/


All Articles