Question

I'm using the skeleton application for ZF2.0.0Beta3.

So, normally I would just use Zend_Debug::dump($someVar); however, in ZF2 it doesn't include the zend classes it seems.

The error is: Fatal Error: Class 'Zend_Debug' not found..

This is probably a really basic question, but what's the best way to include that class? Do I have to put require_once('path/to/Debug.php');?

Was it helpful?

Solution

It still exists in ZF2, but since ZF2 started using PHP namespaces, you would now have to call it using the Zend namespace:

\Zend\Debug\Debug::dump($var);

or add a use statement at the beginning of the file and call it like this:

use Zend\Debug\Debug;

Debug::dump($var);

OTHER TIPS

In my case this was the correct namespace-path :

\Zend\Debug\Debug::dump($form);

Additionally, you can get it like this:

use Zend\Debug\Debug;

// ...

Debug::dump($someVar);

Seems like a lot of work just to dump a variable, though. I'm pretty sure in most case I'll just end up using \Zend\Debug\Debug::dump() more often.

You can use it like that:

\Zend\Debug::dump('asd') 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top