diff --git a/Bootstraps/Laravel.php b/Bootstraps/Laravel.php index 52e231b..efb3796 100644 --- a/Bootstraps/Laravel.php +++ b/Bootstraps/Laravel.php @@ -58,11 +58,17 @@ public function requestClass() { */ public function getApplication() { - require_once 'bootstrap/autoload.php'; + if (file_exists('bootstrap/autoload.php')) { + require_once 'bootstrap/autoload.php'; + } // Laravel 5 / Lumen + $isLaravel = true; if (file_exists('bootstrap/app.php')) { $this->app = require_once 'bootstrap/app.php'; + if (substr($this->app->version(), 0, 5) === 'Lumen') { + $isLaravel = false; + } } // Laravel 4 @@ -74,7 +80,7 @@ public function getApplication() throw new \RuntimeException('Laravel bootstrap file not found'); } - $kernel = $this->app->make('Illuminate\Contracts\Http\Kernel'); + $kernel = $this->app->make($isLaravel ? 'Illuminate\Contracts\Http\Kernel' : 'Laravel\Lumen\Application'); return $kernel; }