Function that can show the data from database to the twig file


#1

I want to create a view that can show all the data from my database.

This is my function. How can I connect this to my twig file?

Can anyone help :disappointed_relieved:

Best regards.


#2

What does not works?

If you need a template engine you can use the twig by Symfony
Twig initialization in Slim (always into the container).

Anyway i suggest you to see the documentation (container section) for a better approach to the db initialization.

Example of db connection initialization in the container