Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ZF2 loading plugins and helpers
// telling ZF where an action helper is
class Bootstrap extends Application\Bootstrap {
public function _initActionHelpers()
Zend\Loader\PluginClassLoader::addStaticMap(array('loggedinuser' => 'Planet\Controller\Helper\LoggedInUser'));
// registering FC plugins can be done like this
// or simply add resources.frontcontroller.plugins.admin = "PPN\Plugin\AdminContext" to application.ini
public function _initFcPlugins()
$fc = $this->getResource('FrontController');
$plugin = new PPN\Plugin\AdminContext();
class IndexController extends Action
public function init()
// some AHs are pre-aliased, see Zend\Controller\Action\HelperLoader
$this->fm = $this->broker('flashmessenger');
// accessing an AH which was aliased in the Bootstrap
$this->loggedInUser = $this->broker('loggedinuser');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.