如何在Phalcon \ Mvc \ View中转义html

I found that view variables in phalcon could be escaped by Phalcon\Escaper: http://docs.phalconphp.com/en/latest/api/Phalcon_Escaper.html

For example, in Zend, there is a way to call view helpers from view:

// view context
$this->escape($data); // calls View\Helper\Escape
$this->url($params); // calls url view helper
// etc

Is there a way to get such view helpers without creating new object every time? My current idea is to make some BaseView class, extended from Phalcon\Mvc\View and to define some often-used methods there, that will use cached objects.. but i am not sure that it is the best way:

class BaseView extends Phalcon\Mvc\View
{
    // cached helper objects
    $helpers = [];

    // view helper call
    public function url($params)
    { 
       if (!$this->helpers['url']) {
           $this->helpers['url'] = new Phalcon\Mvc\Url();
       }
       return $this->helpers['url']->get($params);
    }
}

You can access the services in the services container (DI) using $this in a view:

<?php 
    echo $this->escaper->escape('<h1>Hello</h1>'); //Access Phalcon\Escaper 
?>

<?php 
    echo $this->url->get('posts/index'); //Access Phalcon\Mvc\Url
?>

Just use the name that was registered in the services container.If you are using Phalcon\DI\FactoryDefault, here's a list of registered services by default: http://docs.phalconphp.com/en/latest/reference/di.html#service-name-conventions