Answer the question
In order to leave comments, you need to log in
How to work with models and templates in Silex?
Hello. There was a need for a small site with the ability to download files using a link like example.con/files/r3Yne, i.е. something like short links. In order not to suffer with routing, I want to use some kind of framework. I am familiar with Laravel, but it seems to me too big for such a site. I think to use Silex, but I did not find examples of working with models and templates in it (maybe I was looking badly). Please send a link to an example of using one and the other, preferably at the same time. And one more thing: is it possible to use controllers like Laravel, i.e. create a controller file and write [email protected] in routes instead of using functions function (){ return 'Hello world'; }
Answer the question
In order to leave comments, you need to log in
Models can be used directly in controllers for simplicity, the template engine is Twig, routes are set, for example, as follows:
For return, there are components from Symfony: HttpFoundation (Request, Response), FileBag.
silex.sensiolabs.org/doc/usage.html#streaming
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question