First off, I do not have anything against OO programming (I'd be mad if i believed so). But I was thinking on some sort of procedural MVC pattern with PHP; let me explain better.
As we all know, variable scopes, unless they are taken from $_SESSION (, database, redis, etc.) are never global and only refer to a singular execution of a script. For example:
class Car {
this->name = "foo";
function setName($name) { ... }
function getName() { return $this->name; }
}
Where obviously in a more common situation, this data will be taken from the DB, otherwise any object car, per execution, would have the same name.
Now, is it not possible to apply MVC pattern on procedural code for simplicity purpose? Imagine a really simple social network like application; I could have a structure like this
*views
-profileview.php
-messageview.php
-loginview.php
-notloggedin.php
*models
-user.php
-message.php
- profile.php
- messages.php
- login.php
where profile, messages and login.php work as controllers and route to the right view; and user and message.php work as the classes, that contain all the functions that are eventually needed by the controllers, such as getUserById($id), postMessage($id, $meesage), etc.
I have simplified it a lot but I think you can sort of understand my point.
What would you think of such implementation on the long run, and why?