Skip to content

Commit 24e158e

Browse files
committed
Adding bootstrap/paths.php to allow specification of custom paths for sections of Laravel.
Signed-off-by: Ben Corlett <[email protected]>
1 parent 8a5f18e commit 24e158e

File tree

4 files changed

+56
-9
lines changed

4 files changed

+56
-9
lines changed

bootstrap/paths.php

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
return array(
4+
5+
/*
6+
|--------------------------------------------------------------------------
7+
| Application Path
8+
|--------------------------------------------------------------------------
9+
|
10+
| Here we just defined the path to the application directory. Most likely
11+
| you will never need to change this value as the default setup should
12+
| work perfectly fine for the vast majority of all our applications.
13+
|
14+
*/
15+
16+
'app' => __DIR__.'/../app',
17+
18+
/*
19+
|--------------------------------------------------------------------------
20+
| Public Path
21+
|--------------------------------------------------------------------------
22+
|
23+
| We understand that not all hosting environments allow flexibility with
24+
| public paths. That's why we allow you to change where your public path
25+
| is below.
26+
|
27+
*/
28+
29+
'public' => __DIR__.'/../public',
30+
31+
/*
32+
|-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
33+
| Base Path
34+
|-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
35+
|
36+
| You probably shouldn't be editing this.
37+
|
38+
*/
39+
40+
'base' => __DIR__.'/..',
41+
42+
);

bootstrap/start.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,21 @@
1515

1616
/*
1717
|--------------------------------------------------------------------------
18-
| Define The Application Path
18+
| Bind Paths
1919
|--------------------------------------------------------------------------
2020
|
21-
| Here we just defined the path to the application directory. Most likely
22-
| you will never need to change this value as the default setup should
23-
| work perfectly fine for the vast majority of all our applications.
21+
| Here we are binding the paths configured in paths.php to the app. You
22+
| should not be changing these here but rather in paths.php.
2423
|
2524
*/
2625

27-
$app->instance('path', $appPath = __DIR__.'/../app');
26+
$paths = require __DIR__.'/paths.php';
2827

29-
$app->instance('path.base', __DIR__.'/..');
28+
$app->instance('path', $appPath = $paths['app']);
29+
30+
$app->instance('path.base', $paths['base']);
31+
32+
$app->instance('path.public', $paths['public']);
3033

3134
/*
3235
|--------------------------------------------------------------------------

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
]
1313
},
1414
"minimum-stability": "dev"
15-
}
15+
}

server.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
$uri = urldecode($uri);
66

7-
$requested = __DIR__.'/public'.$uri;
7+
$paths = require __DIR__.'/bootstrap/paths.php';
8+
9+
$requested = $paths['public'].$uri;
810

911
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
1012
// built-in PHP web server. This provides a convenient way to test a Laravel
@@ -14,4 +16,4 @@
1416
return false;
1517
}
1618

17-
require_once(__DIR__ . '/public/index.php');
19+
require_once $paths['public'].'/index.php';

0 commit comments

Comments
 (0)