I read much about PHP MVC pattern yesterday and I wanna get in touch with it. I never did that I always had one class for a whole app, but I want a better structure and get better with OOP.
I want to use twig as template engine, because its easy to use and no other installation required, I already started by creating my folder structure in netbeans, it looks currently like this:
## Source Tree
.
|── controllers
| |── feedreader.php
|
|── CSS
|── images
|── js
|
|── models
| |── database.php
|
|── vendor
| |── twig
| |── twig
| |── ...
| |── autoload.php
|── views
| |── index.html
|
|── composer.json
|── composer.lock
|── index.php
Currently this is my structure where I want to start from.
I am going to create my model ( which only does mysql queries ) db.php. Then I will start to work in the controller.php and programm the logic of my APP for example a function that checks if a user already exists in the database. But then there is the template engine.
How do I use it? Will I check on the index.php what site is requested by the visitor and then load the template? And how dos this work with the controller to compute the request?
You see there are many questions.
Can you help me? I want to learn to code with MVC and a template engine. Do you know any good examples or posts where I can learn?
regards & thanks