Help understanding the mvc framework

Hi, im trying to learn how to make my own mvc framework in php and i have found videos of people doing it but they dont go alot in details on how it works, mainly they just want to copy the code, i know there are lots of frameworks out there that do this for you but i refuse to use something that i dont fully understand, if you know a good Video explaining this topic i would appreciate it, thanks in advance

you need to first understand, which is the design pattern Model-View-Controller

I know a good framework, it can help you

1 Like

I think @sofaires already knows what MVC is but interested in making his own MVC framework and is seeking to more fully understand how it works behind the scenes so he can make one of his own.

I think you should start first in writing your own “Router”, with a function to parse the URL string and break it down into it’s parts. (using pattern matching, regular expressions, etc)

Given a URL like this, you’d have to match with your route table, and extract what are the relevant items… the controller name (which will also be the view name), the url parameter passed to it, etc. You will also need to detect actions on the url like /edit/ or /add/ if any, and on what record ids they pertain too, i.e. /edit/1234

A little googling for “routing php controller” brings this result. You can study this one before making your own.

1 Like

Thanks everyone, thanks @owel exactly what i needed, i appreciate it. Yea i was looking at how it works