Skip to content

Commit

Permalink
Adding bootstrap/paths.php to allow specification of custom paths for…
Browse files Browse the repository at this point in the history
… sections of Laravel.

Signed-off-by: Ben Corlett <bencorlett@me.com>
  • Loading branch information
bencorlett committed Feb 7, 2013
1 parent 8a5f18e commit 24e158e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 9 deletions.
42 changes: 42 additions & 0 deletions bootstrap/paths.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

return array(

/*
|--------------------------------------------------------------------------
| Application Path
|--------------------------------------------------------------------------
|
| Here we just defined the path to the application directory. Most likely
| you will never need to change this value as the default setup should
| work perfectly fine for the vast majority of all our applications.
|
*/

'app' => __DIR__.'/../app',

/*
|--------------------------------------------------------------------------
| Public Path
|--------------------------------------------------------------------------
|
| We understand that not all hosting environments allow flexibility with
| public paths. That's why we allow you to change where your public path
| is below.
|
*/

'public' => __DIR__.'/../public',

/*
|-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
| Base Path
|-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
|
| You probably shouldn't be editing this.
|
*/

'base' => __DIR__.'/..',

);
15 changes: 9 additions & 6 deletions bootstrap/start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@

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

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

$app->instance('path.base', __DIR__.'/..');
$app->instance('path', $appPath = $paths['app']);

$app->instance('path.base', $paths['base']);

$app->instance('path.public', $paths['public']);

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
]
},
"minimum-stability": "dev"
}
}
6 changes: 4 additions & 2 deletions server.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

$uri = urldecode($uri);

$requested = __DIR__.'/public'.$uri;
$paths = require __DIR__.'/bootstrap/paths.php';

$requested = $paths['public'].$uri;

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

require_once(__DIR__ . '/public/index.php');
require_once $paths['public'].'/index.php';

0 comments on commit 24e158e

Please sign in to comment.