Laravel: dependency injection in commands
<p>Is dependency injection of a <strong>custom class</strong> in a <code>command</code> possible? </p>

<p>I'm trying this:</p>

<pre><code>&lt;?php

namespace vendor\package\Commands;

use Illuminate\Console\Command;
use vendor\package\Models\Log;
use vendor\package\Updates\UpdateStatistics;

class UpdatePublishmentStats extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'vendorname:updatePublishmentStats';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Updates Twitter followers &amp; Facebook page likes';

    /**
     * Contact implementation
     * @var vendor\package\Update\UpdateStatistics
     */
    protected $stats;

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct(
        Log $log,
        UpdateStatistics $stats
    ) {
        parent::__construct();
        $this-&gt;log = $log;
        $this-&gt;stats = $stats;
    }
</code></pre>

<p>But when I try to do this:</p>

<pre><code>public function handle()
{
    $this-&gt;stats-&gt;updateFbStats();

}
</code></pre>

<p>I suddenly get <code>Segmentation fault: 11</code></p>

<p>When I delete the <code>use vendor\package\Updates\UpdateStatistics;</code> part, I don't get that error. </p>

<p>So what am I doing wrong here? Is it not possible to use dependency injection in a command? </p>