Laravel change paths

Change storage path

To change the storage path in Laravel (tested with version 5.2 and 5.3) you have to extend the Application class and then override the storagePath() method. You can do this all in the bootstrap/app.php file:

class MyApplication extends \Illuminate\Foundation\Application {

  public function storagePath() {
    return $this->basePath . '/../storage';


// Change this also (was Illuminate\Foundation\Application)
$app = new MyApplication(

Change vendor path

Update: setting a new vendor path in Laravel causes issues with artisan optimize command. So instead of the solution below it is better to make a symlink instead and point to a different location. That way you don't have to do anything in Laravel or Composer and everything works...

To change the vendor path, you have to both tell Laravel and composer the new location.

To let Laravel know the new location, just update the following line in the bootstrap/autoload.php file:

require __DIR__.'/../vendor_new/autoload.php';

Note: make sure to do this after you changed some paths, otherwise you can some errors:

composer dump-autoload

To let composer know this new location, add the vendor-dir config to the composer.json. This can be done easily with the composer CLI:

composer config vendor-dir ../vendor_test

If you have to run composer from somewhere else, you can add the working directory to this command:

composer config vendor-dir ../vendor_test -d my_working_directory
Tag: , | Category: