Add an index page to the root pointing to the bootstrap dir

This commit is contained in:
Nabeel Shahzad 2017-12-17 01:03:19 -06:00
parent b2475720f2
commit 817d3262d4
4 changed files with 36 additions and 5 deletions

View File

@ -4,10 +4,6 @@ if(!defined('LUMEN_START')) {
define('LUMEN_START', microtime(true)); define('LUMEN_START', microtime(true));
} }
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
include_once __DIR__ . '/application.php'; include_once __DIR__ . '/application.php';
$app = new Application(); $app = new Application();

View File

@ -2,12 +2,18 @@
use Illuminate\Foundation\Application as LaravelApplication; use Illuminate\Foundation\Application as LaravelApplication;
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/** /**
* Customized container to allow some of the base Laravel * Customized container to allow some of the base Laravel
* configurations to be overridden * configurations to be overridden
*/ */
class Application extends LaravelApplication class Application extends LaravelApplication
{ {
private $publicPath;
public function __construct(string $basePath = null) public function __construct(string $basePath = null)
{ {
parent::__construct(dirname(__DIR__) . '/'); parent::__construct(dirname(__DIR__) . '/');
@ -42,6 +48,11 @@ class Application extends LaravelApplication
* Override paths * Override paths
*/ */
public function setPublicPath($publicPath)
{
$this->publicPath = $publicPath;
}
public function configPath($path = '') public function configPath($path = '')
{ {
return $this->basePath . DS . 'config' . ($path ? DS . $path : $path); return $this->basePath . DS . 'config' . ($path ? DS . $path : $path);
@ -59,7 +70,7 @@ class Application extends LaravelApplication
public function publicPath() public function publicPath()
{ {
return $this->basePath . DS . 'public'; return $this->publicPath ?: $this->basePath . DS . 'public';
} }
public function resourcePath($path = '') public function resourcePath($path = '')

22
index.php Executable file
View File

@ -0,0 +1,22 @@
<?php
/**
* phpVMS
*/
$path_to_phpvms_folder = __DIR__;
require $path_to_phpvms_folder.'/bootstrap/autoload.php';
$app = require_once $path_to_phpvms_folder.'/bootstrap/app.php';
$app->setPublicPath(__DIR__ . '/public');
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$response->send();
$kernel->terminate($request, $response);

View File

@ -19,6 +19,8 @@ require $path_to_phpvms_folder.'/bootstrap/autoload.php';
*/ */
$app = require_once $path_to_phpvms_folder.'/bootstrap/app.php'; $app = require_once $path_to_phpvms_folder.'/bootstrap/app.php';
$app->setPublicPath(__DIR__);
$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
$response = $kernel->handle( $response = $kernel->handle(