Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use MVC in a php website? [closed]

Many frameworks are based on mvc, but I have no idea about MVC. So what is the use of MVC? Is it for speed, security or any other reason?

like image 704
Gowri Avatar asked Jan 22 '23 06:01

Gowri


2 Answers

MVC allows you to separate your business logic from your presentation layer. This "Separation of Concerns" allows you to quickly find and edit portions of your code. It also enables easy reuse of your UI components across your system.

Check out the wiki page for a overly academic and technical introduction to MVC http://en.wikipedia.org/wiki/Model_view_controller

like image 56
Dlongnecker Avatar answered Jan 23 '23 20:01

Dlongnecker


MVC is mostly for better maintainability of your code. By separating the database logic from the presentational logic from the controller logic you can make changes/rewrites/maintence more easily.

like image 39
Atomix Avatar answered Jan 23 '23 20:01

Atomix