Skip to content

Instantly share code, notes, and snippets.

@tomshaw
Last active December 16, 2015 18:00
Show Gist options
  • Save tomshaw/5474845 to your computer and use it in GitHub Desktop.
Save tomshaw/5474845 to your computer and use it in GitHub Desktop.
ZF2 debug dump controller plugin.
<?php
namespace Application\Controller\Plugin;
use Zend\Mvc\Controller\Plugin\AbstractPlugin;
use Zend\Debug\Debug;
class Dump extends AbstractPlugin
{
public function __invoke($var, $label = null, $echo = true)
{
return Debug::dump($var, $label = null, $echo = true);
}
}
public function getControllerPluginConfig()
{
return array(
'invokables' => array(
'dump' => 'Application\Controller\Plugin\Dump'
)
);
}
// Usage
$this->dump(get_class_methods($this));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment