Hey,

I would simply like to give a huge +1 to Larry's answer because he did nail 
the problem perfectly.

Escaping is done in the template, therefore is used by template engine 
authors. There are not a hundred different ways to do escaping and an 
escaping PSR would really dictate an implementation which is not what FIG 
is doing.

On the other end, there are huge interoperability issues at the template 
level. There are indeed a hundred different ways to write a template (Twig, 
Blade, Mustache, Smarty, pure PHP, you name it...), but all templates have 
in common that they take an array of parameters and that they spit out some 
HTML (or more precisely a string of content).

Therefore, IMHO, efforts to increase interoperability might be better 
focused it the template level rather than at the espcaping level.

For instance:

interface TemplateInterface
{
    public function render(array $parameters) : string;
}

Such an interface could be used to abstract template rendering from the 
actual implementation (think about rewriting all Smarty templates into Twig 
templates in a project without touching the PHP code base, just swapping 
the implementation of the template). Each template engine is internally in 
charge of the escaping so we don't need to focus on that.

++
David.


Le jeudi 6 octobre 2016 10:45:47 UTC+2, Matteo Beccati a écrit :
>
> Hi, 
>
> On 06/10/2016 09:53, Alessandro Lai wrote: 
> > Maybe the aim of this PSR should be a test suite (or at least a data 
> > provider of common and edge cases for tests) instead of an interface: if 
> > your escaper pass all the tests, it's PSR-x compliant. 
> > 
> > This could be a really good standard, which any implementer can look up 
> > to to see if its implementation is up to the task. 
>
> Still, I don't think it's a suitable goal for a PSR. We'd be defining 
> the output of an implementation, which is more or less like providing 
> one. What would be the benefit? 
>
>
> Cheers 
> -- 
> Matteo Beccati 
>
> Development & Consulting - http://www.beccati.com/ 
>

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/08a4aa53-7fd1-46db-a237-2a1d2fed43fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to