Skip to content

Commit b9a40cb

Browse files
author
Matt Allan
committed
correct the Laravel bootstrap path
- fix the path for compatibility with L5 and Lumen - assume the working dir is the application root - throw an exception instead of failing silently
1 parent a28a4a5 commit b9a40cb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

Bootstraps/Laravel.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,28 @@ public function __construct($appenv)
3131
}
3232

3333
/**
34-
* Create a Symfony application
34+
* Create a Laravel application
3535
*/
3636
public function getApplication()
3737
{
38-
if (file_exists(__DIR__ . '/autoload.php') && file_exists(__DIR__ . '/start.php')) {
39-
require_once __DIR__ . '/autoload.php';
40-
$this->app = require_once __DIR__ . '/start.php';
38+
// Laravel 5 / Lumen
39+
if (file_exists('bootstrap/app.php')) {
40+
return $this->app = require_once 'bootstrap/app.php';
4141
}
4242

43-
return $this->app;
43+
// Laravel 4
44+
if (file_exists('bootstrap/start.php')) {
45+
require_once 'bootstrap/autoload.php';
46+
return $this->app = require_once 'bootstrap/start.php';
47+
}
48+
49+
throw new \RuntimeException('Laravel bootstrap file not found');
4450
}
4551

4652
/**
4753
* Return the StackPHP stack.
54+
* @param Builder $stack
55+
* @return Builder
4856
*/
4957
public function getStack(Builder $stack)
5058
{

0 commit comments

Comments
 (0)