You do not need to modify basePath unless you are using a custom application structure. Kind:
bootstrap ├── app.php └── autoload.php config ├── app.php ├── auth.php ├── cache.php ├── compile.php [...] src └── Traviola ├── Application.php ├── Commands │ └── Command.php ├── Console │ ├── Commands [...]
So, in your case, all you have to do is:
$app->run();
Hope this helps.
Additional
If you are wondering how Lumen does not work in a subfolder. You can see Laravel\Lumen\Application::getPathInfo() line 1359 . For Lumen to work in a subfolder, change this method, just create a class that extends Laravel\Lumen\Application .
<?php namespace App; use Laravel\Lumen\Application as BaseApplication; class Application extends BaseApplication { public function getPathInfo() { $query = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ''; return '/'.ltrim( str_replace( '?'.$query, '', str_replace( rtrim( str_replace( last(explode('/', $_SERVER['PHP_SELF'])), '', $_SERVER['SCRIPT_NAME'] ), '/'), '', $_SERVER['REQUEST_URI'] ) ), '/'); } }
Then, in bootstrap/app.php , change this:
$app = new App\Application( realpath(__DIR__.'/../') );
After that, you do not need to modify the public/index.php file, just specify it by default:
$app->run();
source share