Skip to content

Commit 0bb48d2

Browse files
committed
Added laravel 5 support
Removed stack/builder dep
1 parent e113dd2 commit 0bb48d2

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

Bootstraps/Laravel.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public function __construct($appenv, $debug)
3434
{
3535
$this->appenv = $appenv;
3636
$this->debug = $debug;
37-
putenv("APP_DEBUG=" . ($debug ? 'TRUE' : 'FALSE'));
37+
putenv("APP_DEBUG=" . ($debug ? 'true' : 'false'));
38+
putenv("APP_ENV=" . $this->appenv);
3839
}
3940

4041
/**
@@ -49,17 +50,27 @@ public function getStaticDirectory() {
4950
*/
5051
public function getApplication()
5152
{
53+
54+
if (file_exists('bootstrap/autoload.php')) {
55+
require_once 'bootstrap/autoload.php';
56+
}
57+
5258
// Laravel 5 / Lumen
5359
if (file_exists('bootstrap/app.php')) {
54-
return $this->app = require_once 'bootstrap/app.php';
60+
$this->app = require_once 'bootstrap/app.php';
5561
}
5662

5763
// Laravel 4
5864
if (file_exists('bootstrap/start.php')) {
59-
require_once 'bootstrap/autoload.php';
60-
return $this->app = require_once 'bootstrap/start.php';
65+
$this->app = require_once 'bootstrap/start.php';
66+
}
67+
68+
if (!$this->app) {
69+
throw new \RuntimeException('Laravel bootstrap file not found');
6170
}
6271

63-
throw new \RuntimeException('Laravel bootstrap file not found');
72+
$this->app->boot();
73+
74+
return $this->app;
6475
}
6576
}

Bridges/HttpKernel.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,7 @@ protected static function mapRequest(ReactRequest $reactRequest)
136136
*/
137137
protected static function mapResponse(HttpResponse $reactResponse, SymfonyResponse $syResponse)
138138
{
139-
$syResponse->sendHeaders();
140-
141-
ob_start();
142-
$syResponse->sendContent();
143-
$content = ob_get_contents();
144-
ob_end_clean();
139+
$content = $syResponse->getContent();
145140

146141
$headers = $syResponse->headers->allPreserveCase();
147142
$cookies = [];

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "php-pm/httpkernel-adapter",
33
"require": {
4-
"stack/builder": "^1.0",
54
"symfony/http-foundation": "^2.6|^3.0",
65
"symfony/http-kernel": "^2.6|^3.0"
76
},

0 commit comments

Comments
 (0)