title: How to detect if a Zend Framework 2 application runs in console or HTTP context?
body: <p>I'm writing a module to perform some tasks based on if the application is running in the console or HTTP context. Is there a way to detect this when the module is loaded?</p>
  
  <p>For example, I try doing this with <strong>Module.php</strong> class.</p>
  
  <pre><code>namespace MyModule;
  
  use ...
  
  class Module
  {
      public function init(ModuleManager $mm)
      {
          if (Console context) {
              // do something
          } else {
              // do something with HTTP
          }
      } 
  }
  </code></pre>
  
  <p>Thanks!</p>