# MVC ## Modele Vue Controller --- ### Arborescence du projet ```txt project_root/ │ ├── app/ │ ├── config/ │ └── config.php │ └── public/ ``` --- ### Arborescence du projet #### /public ```txt public/ ├── index.php ├── print_hello.php └── css/ └── style.css ``` --- ### Arborescence du projet #### /public/print_hello.php ```php index(); ?> ``` --- ### Arborescence du projet #### /app ```txt[] app/ │ ├── controllers/ │ ├── entities/ │ ├── repositories/ │ ├── services/ │ ├── trait/ │ ├── views/ │ └─ core/ ``` --- ### Arborescence du projet #### /app/controllers ```php[1-4|6-10|12-15|17-20|22-25] require_once '../app/core/Controller.php'; require_once '../app/services/HelloService.php'; class HelloWorldController extends Controller { private HelloService $helloService; public function __construct() { $this->helloService = new HelloService(); } public function index():void { $this->view('hello_world', $this->helloService->hello(), ['name' => 'Salim']); } public function indexJson():void { $this->json(['title' => $this->helloService->hello(), 'name' => 'Salim']); } public function redirectToJson() { $this->redirectTo('/json.php'); } } ``` --- ### Arborescence du projet #### /app/entities et /app/repositories ##### Entities - Classes représentant les tables de la base de données ##### Repositories - Gestion des connexions à la base de données et exécution des requêtes SQL --- ### Arborescence du projet #### /app/services ```php[] view('hello_world', $this->helloService->hello(), ['name' => 'Salim','errors'=>['Nom incorrect']]); } ``` ```php[]