Php – Is MVC now the only way to write PHP

mvcPHP

Hey… its XMAS Eve and something is bugging me… yes, I have work on my mind even when I am on holiday. The vast amount of frameworks available for PHP now use MVC. Even ASP.net has its own MVC module.

I can see the attraction of MVC, I really can and I use it frequently. The only downside that I can see is that you have to fire up the whole system to execute a page request. Depending on your task this can be a little wasteful.

So the question. In a professional environment is this the only way to use PHP nowadays or are their other design methods which have alternative benefits?

Best Answer

No.

What pattern you use always depends on the task your program/script has to perform. Just yesterday I had to solve this:

  • show the mtime of two files
  • show number of temp files in a folder
  • allow deleting all temp files with one click
  • web interface

I know one could argue that a nice reusable MVC solution would be cleaner, but I choose a 20 lines of sequential code. Why? It is fast. It is small. And every minute I spend on this is a minute I can not use on my main project.

(let the hate begin!)

Related Topic