Yii2 equivalent for htmlentities

Yii2 provides the HTML helper function encode() (https://www.yiiframework.com/doc/api/2.0/yii-helpers-basehtml#encode()-detail) , which runs an PHP htmlspecialchars.
But it seams not possible to pass one of that many options from Yii’s encode to PHPs htmlspecialchars, like ENT_QUOTES.
On the other hand, there seams no Yii2 equivalent for PHPs htmlentities for example to encode quotes, right?

So how is the best Yii-way to encode quotes, to realize something like that:

<?PHP $t = 'This is "the best".' echo 'bla'; ?>

Have you tried with php function htmlentities ?

May be related: https://www.yiiframework.com/doc/api/2.0/yii-helpers-htmlpurifier

1 Like

Yes. But the question was, if there is a Yii version for this function. Because, there is an Yii equivalent for PHPs htmlspecialchars, which is the html helper method encode(). But it seams there is no Yii method, that wraps php function htmlentities.