The answer is NO. Why? Because from simple application written in core PHP to latest framework like Laravel having some advantage over it. Check this how.
- With core PHP application – You have to write each query again & again, You have to mix PHP with HTML and your files becomes miserable when application becomes big. It will be hard to maintain for a new guy who just join into the project.
- So to overcome this issue of writing same code again & again we need to use reusable functions. Then the functional programming introduced with PHP. it’s easy to call same function for add user or delete post etc. Just pass the arguments in functions and you are done. This is Functional Programming.
- But what about the situation when there are same named functions in application. For example addUser(). It may be the member or site administrator or shop manager. correct? So developer get confused about addUser() will add new user as site administrator or shop manager or shop manager what? So to fix this we need to link addUser() function to a class say class member and same addUser function name we can create with another class named shop manager. Get it? This is Object Oriented Programming. Also there are some more advantage of oops like security, Inheritance etc any many more.
- Now it looks perfect that you have a class and it’s functions. Looks fine then why we need MVC? Because in oops application you have to call class functions in view files. For example you have to call a class function viewPosts() in the view file which is parsing in frontend so it needs to make a many server side requests and it becomes frontend slow. So how to overcome with this problem? Then we introduce a intermediator layer called ‘Model’. ‘Model’ is a sandwich layer between ‘Controller’ which a class & ‘View’ which is a full with HTML & CSS & JS. So ideally when application requests occur, it will first call to Controller. Controller parse the URL data and decide which model to call. In model file it connect with DB and parse the query and collect the data and that data of array it sends to view file. So View do not need to parse anything. It has all data in array format to display. So parsing is fast for view file in client side. Just add one layer as Model and you will get a clean HTML file as a view file.
Ah! that is the logic to use MVC over OOPS application. - Now what is the logic to use Laravel or CodeIgniter or any other framework? Simple because MVC is advance way to create application and we need a universal MVC which is easy to understand, manage globally and advance in techniques. In a framework there are prope document and a fixed MVC structure which all developers follow. You can create your MVC structure which you can use in multiple application. Someone else can make different type of MVC for him so for developer it is beneficial if we use a universal MVC so anybody can understand its layer and syntax.
I hope I am able to explain the war of simple php application to framework based idea.
That’s it for now.