Closed pine3ree closed 8 years ago
Largely the decision was to try and mirror the Twig Package.
If we wanted to get really technical the view should be provided a PSR Stream interface, but it would be a huge BC break.
Separately we are looking at providing a unified view interface, but it will likely take a bit to work out all the details for it,
We do provide a way to render a template to a string.
https://github.com/slimphp/PHP-View/blob/master/src/PhpRenderer.php#L148
I hope this answers your question
@geggleto Thank You for the explaination on the design choice. kind regards
Hello,
I was wondering why the render method has a ResponseInterfaceparameter. Wouldn't it be better to write to the body inside the route-matching middleware:
and have the PhpRenderer just do 1 job: pass data into a template and return the resulting string? For instance, what if i just need to render a template for an html email? Doesn't this also violate the SRP? In my opinion a view renderer shouldn't have the responsibility of filling a response.
thanks and kind regards maks