Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing FirePHP with Zend Framework 2
    primarykey
    data
    text
    <p>I'm trying to use FirePHP with Zend Framework 2, but there seems to be something missing. Here's the basic code I'm trying to run:</p> <pre><code>$writer = new Zend\Log\Writer\FirePhp(); $logger = new Zend\Log\Logger(); $logger-&gt;addWriter($writer); $logger-&gt;info('FirePHP logging enabled'); </code></pre> <p>The error I get is "FirePHP Class not found". I was initially puzzled because I do have a FirePhp class in my Zend/Log/Writer folder. But then I saw that the class constructor requires a FirePhp\FirePhpInterface object. So I checked the Zend/Log/Writer/FirePhp folder and there's a FirePhpBridge class in there that implements FirePhpInterface, but it also requires a FirePHP instance in the constructor. I don't have any FirePHP.php file in my Zend/Log/Writer/FirePhp folder. Am I supposed to get this from somewhere else?</p> <p><strong>Update</strong></p> <p>I now have managed to get FirePHP working, but I'm trying to figure out how to do it in a clean way so this works. The only way I've gotten it to work is putting it in the root directory of my project and doing the following:</p> <pre><code>include_once('FirePHP.php'); $writer = new Zend\Log\Writer\FirePhp(new Zend\Log\Writer\FirePhp\FirePhpBridge(FirePHP::getInstance(true))); $logger = new Zend\Log\Logger(); $logger-&gt;addWriter($writer); $logger-&gt;info('FirePHP logging enabled'); </code></pre> <p>I assume that normally I should be able to create a writer like so:</p> <pre><code>$writer = new Zend\Log\Writer\FirePhp(); </code></pre> <p>However, where this goes wrong I believe is in the getFirePhp() function of the Zend\Log\Writer\FirePhp class. The class does this:</p> <pre><code>if (!$this-&gt;firephp instanceof FirePhp\FirePhpInterface &amp;&amp; !class_exists('FirePHP') ) { // No FirePHP instance, and no way to create one throw new Exception\RuntimeException('FirePHP Class not found'); } // Remember: class names in strings are absolute; thus the class_exists // here references the canonical name for the FirePHP class if (!$this-&gt;firephp instanceof FirePhp\FirePhpInterface &amp;&amp; class_exists('FirePHP') ) { // FirePHPService is an alias for FirePHP; otherwise the class // names would clash in this file on this line. $this-&gt;setFirePhp(new FirePhp\FirePhpBridge(new FirePHPService())); } </code></pre> <p>This is where I get lost as to how I'm supposed to set things up so that this class_exists('FirePHP') call finds the right class and new FirePHPService() also works properly.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload