jHertel has already given a brief introduction to what MVC is, some questions that may help you with this specifically:
From my summary point of view, MVC does not have a specific pattern, in fact in many ways you can make use of this and achieve the same result, can be strict or not, the inphinit is not strict (strict), in fact it is well "free", except for the Controllers
which are almost always mandatory (although bear Closures
).
So the MVC is a way of organizing and not a technology, from my point of view, the most common MVC represented is this:
inphinit follows many things similar to other known frameworks, having the folder and namespace for Controller
and Model
(View
no namespace), this class you posted was one of the experimental examples you were performing:
<?php
namespace Model;
class User extends \Inphinit\Experimental\Model
{
}
At the time I removed the class \Inphinit\Experimental\Model
, not because it is wrong, but because it does not yet achieve what I hope, from my point of view Models has nothing to do with database, they only use the data contained in them, the goal of the Model is to define the "business rules", thus making use of any kind of information, having the ability to get them, update and delete, but all this having rules.
However, I believe that a Model, wherever it is, should never manipulate things directly, such as sending data to the ouput, or sending a response, it should only send the answer (if any) to the controller and the controller should take care of the rest (of course I appreciate this with the experience I had with totally different tools, as MVC said is not always the same in two different places or frameworks).
In most of the frameworks I notice the Model is used merely as a connecting instrument with the bank and some rules end up falling within the Controller
.
When I idealized inphinit he had 5 goals:
- Support PHP 5.3
- Spend as little memory as possible
- Be as fast as possible without numerous cycles inside the core.
- Be as simple as possible for learning
- Support third party libraries (3rdparty) that is installed via Composer
With this ultimate goal we come to namespace Model;
and the folder system/application/Model/
, the framework has nothing like Migration, connection and sqlbuilder, but this does not mean that you can not install things from third parties, there are frameworks that even used with it as:
That is the focus of the folder and namespace Model
is the same as most frameworks, however it can be used with the ORM you desire or as you wish
As soon as possible Add a step-by-step from one or more frameworks to work with the namespace Model
.
@Guilhermenascimento will be able to better explain :P, but if it follows the standard [tag:mvc] (Model, View, Controller), Model usually houses the database queries.
– MarceloBoni