Simplest method currently is to have a BaseController that loads it up. It can be done something like:
Code:
class BaseController extends CodeIgniter\Controller
{
protected $helpers = []; // this is already part of the Controller class
public function __construct(...$params)
{
parent::__construct(...$params);
$this->helpers = array_merge($this->helpers, ['url', 'foo']);
}
}
This is a little more work up front, but most projects will see you using a base controller or two anyway.