title: Laravel 5.5 Override vendor class
body: <p>I'm trying to override (not extend) a vendor class. So whenever the vendor class gets called (within the vendor code), I want it to call my custom class. </p>
  
  <p>It looks like I need to alias the class in my <code>App/Providers/AppServiceProvider</code></p>
  
  <p>I've tried this:</p>
  
  <pre><code>$loader = \Illuminate\Foundation\AliasLoader::getInstance();
  $loader-&gt;alias('Vendor\VendorName\Class', 'App\Vendor\MyCustomClass');
  </code></pre>
  
  <p>But this doesn't do anything. </p>
  
  <p>I can get my class registered fine:</p>
  
  <pre><code> $this-&gt;app-&gt;register(
         'App\Vendor\MyCustomClass'
     );
  </code></pre>
  
  <p>But this then fails as the constructor relys on other variables not available at that point. I literally just need the app to override any call to <code>Vendor\VendorName\Class</code> with <code>App\Vendor\MyCustomClass</code></p>