Commit 79c58652 by Taylor Otwell

working on the core bootstrap comments.

parent d57af216
<?php namespace Laravel;
// --------------------------------------------------------------
// Define the PHP file extensions.
// --------------------------------------------------------------
define('EXT', '.php');
define('BLADE_EXT', '.blade.php');
// --------------------------------------------------------------
// Define the core framework paths.
// --------------------------------------------------------------
/**
* Define core framework paths and constants.
*/
define('APP_PATH', realpath($application).'/');
define('BASE_PATH', realpath(str_replace('laravel', '', $laravel)).'/');
define('PACKAGE_PATH', realpath($packages).'/');
......@@ -18,9 +12,6 @@ define('SYS_PATH', realpath($laravel).'/');
unset($laravel, $application, $config, $packages, $public, $storage);
// --------------------------------------------------------------
// Define various other framework paths.
// --------------------------------------------------------------
define('CACHE_PATH', STORAGE_PATH.'cache/');
define('CONFIG_PATH', APP_PATH.'config/');
define('CONTROLLER_PATH', APP_PATH.'controllers/');
......@@ -32,54 +23,60 @@ define('SYS_CONFIG_PATH', SYS_PATH.'config/');
define('SYS_LANG_PATH', SYS_PATH.'language/');
define('VIEW_PATH', APP_PATH.'views/');
// --------------------------------------------------------------
// Load the configuration manager and its dependencies.
// --------------------------------------------------------------
define('EXT', '.php');
define('BLADE_EXT', '.blade.php');
/**
* Load the classes that can't be resolved through the auto-loader.
* Typically, these are classes that are used by the auto-loader
* or configuration classes.
*/
require SYS_PATH.'facades'.EXT;
require SYS_PATH.'config'.EXT;
require SYS_PATH.'loader'.EXT;
require SYS_PATH.'arr'.EXT;
// --------------------------------------------------------------
// Determine the application environment.
// --------------------------------------------------------------
/**
* Determine the application environment. The environment is typically
* set by an environment variable on the server.
*/
$environment = (isset($_SERVER['LARAVEL_ENV'])) ? $_SERVER['LARAVEL_ENV'] : null;
// --------------------------------------------------------------
// Register the configuration file paths.
// --------------------------------------------------------------
$config = array(SYS_CONFIG_PATH, CONFIG_PATH);
if ( ! is_null($environment)) $config[] = CONFIG_PATH.$environment.'/';
/**
* Register the path to the configuration files.
*/
$configs = array(SYS_CONFIG_PATH, CONFIG_PATH);
Config::paths($config);
if ( ! is_null($environment)) $configs[] = CONFIG_PATH.$environment.'/';
// --------------------------------------------------------------
// Set a few core configuration options.
// --------------------------------------------------------------
Config::set('view.path', VIEW_PATH);
Config::$paths = $configs;
// --------------------------------------------------------------
// Bootstrap the IoC container.
// --------------------------------------------------------------
/**
* Bootstrap the application inversion of control (IoC) container.
* The container provides the convenient resolution of objects and
* their dependencies, allowing for flexibility and testability
* within the framework.
*/
require SYS_PATH.'container'.EXT;
$container = new Container(Config::get('container'));
IoC::$container = $container;
// --------------------------------------------------------------
// Register the auto-loader on the auto-loader stack.
// --------------------------------------------------------------
/**
* Register the application auto-loader. The auto-loader is responsible
* for the lazy-loading of all of the Laravel core classes, as well as
* the developer created libraries and models.
*/
spl_autoload_register(array('Laravel\\Loader', 'load'));
Loader::$paths = array(BASE_PATH, APP_PATH.'models/', APP_PATH);
Loader::$paths = array(BASE_PATH, APP_PATH.'models/', APP_PATH.'libraries/', APP_PATH);
Loader::$aliases = Config::get('aliases');
// --------------------------------------------------------------
// Define some convenient global functions.
// --------------------------------------------------------------
/**
* Define a few convenient global functions.
*/
function e($value)
{
return HTML::entities($value);
......
......@@ -16,18 +16,7 @@ class Config {
*
* @var array
*/
protected static $paths = array();
/**
* Set the paths in which the configuration files are located.
*
* @param array $paths
* @return void
*/
public static function paths($paths)
{
static::$paths = $paths;
}
public static $paths = array();
/**
* Determine if a configuration item or file exists.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment