title: How to output info text from class method invoked via artisan command in Laravel 4
body: <p>I have a couple of classes (services) which I use in the main Laravel app as well as via <code>artisan</code> commands.</p>
  
  <p>What I would like to do is being able to display some output when invoking such class methods via <code>artisan</code> (as <code>$this-&gt;info(...)</code> inside the command itself) and just eventually return a value (response, result object or similar) when using them within the main app.</p>
  
  <p>Right now I just used them as commands and achieved the output effect by <code>echo</code>ing the statements I needed directly from within the methods, but I'm convinced this is not the correct approach because as soon as I start using them in the app I guess I'm gonna have my responses polluted with these info statements (as well as double headers or similar issues, I imagine).</p>
  
  <p>I wonder what would be a better way to approach such scenario.</p>
  
  <p>Below a code example of what I'm trying to achieve:</p>
  
  <pre><code>// DoSequenceCommand
  
  public function fire() {
      MyClass::doSequence();
  }
  
  // MyClass (Facade)
  
  public function doSequence() {
      echo "Beginning Step 1\n"; // THIS I WOULD BE ABLE TO OUTPUT ONLY IF EXECUTED VIA COMMAND LINE
      $s1 = $this-&gt;step1();
      echo  "Step 1 " . ( $s1 ? "succeded" : "failed" ) . "!\n";
  
      echo "Beginning Step 2\n";
      $s2 = $this-&gt;step2();
      echo  "Step 2 " . ( $s2 ? "succeded" : "failed" ) . "!\n";
  
      return [ "s1" =&gt; $s1, "s2" =&gt; $s2];
  }
  </code></pre>