Do we need to include the class in the constructor?

In Magento 1, we simply use zend_debug::dump()->debug to debug object, how about for Magento 2?


You can use simply following way:


|improve this answer|||||
  • \Zend_Debug is not working in magento 2.3, so do you have any idea how to run \Zend_Debug::dump(); in magento 2.3 ? – Aasim Goriya Feb 20 '19 at 14:02

You can also import Zend_Debug class at the top of your class file:

use Zend_Debug;

Then, your code will work as normal:


OR, you can directly instantiate the object of the class. For this, you don't need to import the class but have to use "backslash" infront of the Zend_Debug class name.


Reference: PHP Documentation on Using namespaces: Aliasing/Importing

|improve this answer|||||
  • in some class, i can use it, but sometimes it cant, do you have any ideas? – leo Mar 16 '17 at 7:45

Zend_Debug gone from 2.3


Affected modules:

  • Zend_Debug

Action: Affected modules and classes were removed.

Reason: They are no longer used in Magento or Marketplace extensions, are expensive and time-intensive to maintain, and can cause potential security risks if not maintained properly.

|improve this answer|||||
  • Thanks for the updates, seems v2.3 removed many Zend functions. Do you know what is another good function for outputing debug message? Just var_dump? – leo Jan 14 '19 at 3:55
  • That was the Magento teams way of getting 2.3 php 7.2 compatible. I used Zend_Debug all the time. I've been using echo <pre>; var_dump($var); – Dominic Xigen Jan 15 '19 at 16:51
  • I've given this more thought magento.stackexchange.com/a/283483/70343 – Dominic Xigen Jul 27 '19 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.