2011-11-22 18:00:17 -06:00
|
|
|
<?php namespace Laravel;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define all of the constants that we will need to use the framework.
|
|
|
|
|
* These are things like file extensions, as well as all of the paths
|
|
|
|
|
* used by the framework. All of the paths are built on top of the
|
|
|
|
|
* basic application, laravel, and public paths.
|
|
|
|
|
*/
|
|
|
|
|
define('EXT', '.php');
|
2011-12-04 02:00:39 -07:00
|
|
|
define('CRLF', "\r\n");
|
2012-01-16 13:59:24 -06:00
|
|
|
define('DEFAULT_BUNDLE', 'application');
|
|
|
|
|
define('MB_STRING', (int) function_exists('mb_get_info'));
|
2011-11-22 18:00:17 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Require all of the classes that can't be loaded by the auto-loader.
|
2012-01-26 20:07:40 -06:00
|
|
|
* These are typically classes that the auto-loader relies upon to
|
|
|
|
|
* load classes, such as the array and configuration classes.
|
2011-11-22 18:00:17 -06:00
|
|
|
*/
|
2012-01-30 13:18:33 -06:00
|
|
|
require path('sys').'event'.EXT;
|
2012-01-28 14:55:08 -06:00
|
|
|
require path('sys').'bundle'.EXT;
|
|
|
|
|
require path('sys').'config'.EXT;
|
|
|
|
|
require path('sys').'helpers'.EXT;
|
|
|
|
|
require path('sys').'autoloader'.EXT;
|
2011-11-22 18:00:17 -06:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Register the Autoloader's "load" method on the auto-loader stack.
|
|
|
|
|
* This method provides the lazy-loading of all class files, as well
|
|
|
|
|
* as any PSR-0 compliant libraries used by the application.
|
|
|
|
|
*/
|
|
|
|
|
spl_autoload_register(array('Laravel\\Autoloader', 'load'));
|
|
|
|
|
|
2012-01-29 17:33:58 -06:00
|
|
|
/**
|
|
|
|
|
* Register the Laravel namespace so that the auto-loader loads it
|
|
|
|
|
* according to the PSR-0 naming conventions. This should provide
|
|
|
|
|
* fast resolution of all core classes.
|
|
|
|
|
*/
|
|
|
|
|
Autoloader::namespaces(array('Laravel' => path('sys')));
|
|
|
|
|
|
2012-01-26 14:37:43 -06:00
|
|
|
/**
|
2012-02-12 14:48:36 -06:00
|
|
|
* Set the CLI options on the $_SERVER global array so we can easily
|
|
|
|
|
* retrieve them from the various parts of the CLI code. We can use
|
|
|
|
|
* the Request class to access them conveniently.
|
2012-01-26 14:37:43 -06:00
|
|
|
*/
|
2012-02-12 14:48:36 -06:00
|
|
|
if (defined('STDIN'))
|
2012-01-26 14:37:43 -06:00
|
|
|
{
|
2012-02-12 14:48:36 -06:00
|
|
|
$console = CLI\Command::options($_SERVER['argv']);
|
|
|
|
|
|
|
|
|
|
list($arguments, $options) = $console;
|
2012-02-07 13:30:23 -06:00
|
|
|
|
2012-02-12 14:48:36 -06:00
|
|
|
$options = array_change_key_case($options, CASE_UPPER);
|
|
|
|
|
|
|
|
|
|
$_SERVER['CLI'] = $options;
|
|
|
|
|
}
|
2012-01-26 20:07:02 -06:00
|
|
|
|
2012-02-07 13:30:23 -06:00
|
|
|
/**
|
2012-02-12 14:48:36 -06:00
|
|
|
* The Laravel environment may be specified on the CLI using the env
|
|
|
|
|
* option, allowing the developer to easily use local configuration
|
|
|
|
|
* files from the CLI since the environment is usually controlled
|
|
|
|
|
* by server environmenet variables.
|
2012-02-07 13:30:23 -06:00
|
|
|
*/
|
2012-02-12 14:48:36 -06:00
|
|
|
if (isset($_SERVER['CLI']['ENV']))
|
2012-02-07 13:30:23 -06:00
|
|
|
{
|
2012-02-12 14:48:36 -06:00
|
|
|
$_SERVER['LARAVEL_ENV'] = $_SERVER['CLI']['ENV'];
|
2012-02-06 09:35:28 -06:00
|
|
|
}
|
|
|
|
|
|
2012-02-12 14:48:36 -06:00
|
|
|
/**
|
2012-03-01 10:55:37 -06:00
|
|
|
* Finally we'll grab all of the bundles and register them with the
|
|
|
|
|
* bundle class. All of the bundles are stored in an array within
|
|
|
|
|
* the application directory which defines all bundles.
|
2012-02-12 14:48:36 -06:00
|
|
|
*/
|
|
|
|
|
$bundles = require path('app').'bundles'.EXT;
|
|
|
|
|
|
|
|
|
|
foreach ($bundles as $bundle => $config)
|
|
|
|
|
{
|
|
|
|
|
Bundle::register($bundle, $config);
|
|
|
|
|
}
|