core.php 2.51 KB
Newer Older
1 2 3 4 5 6 7 8 9
<?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');
10
define('CRLF', "\r\n");
11
define('BLADE_EXT', '.blade.php');
12 13
define('DEFAULT_BUNDLE', 'application');
define('MB_STRING', (int) function_exists('mb_get_info'));
14 15 16

/**
 * Require all of the classes that can't be loaded by the auto-loader.
Taylor Otwell committed
17 18
 * These are typically classes that the auto-loader relies upon to
 * load classes, such as the array and configuration classes.
19
 */
20
require path('sys').'event'.EXT;
Taylor Otwell committed
21 22 23 24
require path('sys').'bundle'.EXT;
require path('sys').'config'.EXT;
require path('sys').'helpers'.EXT;
require path('sys').'autoloader'.EXT;
25 26 27 28 29 30 31 32 33

/**
 * 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'));

/**
34 35 36 37
 * Register all of the core class aliases. These aliases provide a
 * convenient way of working with the Laravel core classes without
 * having to worry about the namespacing. The developer is also
 * free to remove aliases when they extend core classes.
38
 */
39 40 41
Autoloader::$aliases = Config::get('application.aliases');

/**
42 43 44 45 46 47 48
 * 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')));

/**
Taylor Otwell committed
49 50 51 52
 * Grab the bundle manifest for the application. This contains an
 * array of all of the installed bundles, plus information about
 * each of them. If it's not cached, we'll detect them and then
 * cache it to save time later.
53
 */
Taylor Otwell committed
54
$bundles = Cache::remember('laravel.bundle.manifest', function()
55
{
56
	return Bundle::detect(path('bundle'));
Taylor Otwell committed
57 58

}, Config::get('application.bundle.cache'));
59

Taylor Otwell committed
60 61 62 63 64 65 66 67
/**
 * Register all of the bundles that are defined in the main bundle
 * manifest. This informs the framework where the bundle lives
 * and which URIs it can respnod to.
 */
foreach ($bundles as $bundle)
{
	Bundle::register($bundle);
68 69 70 71 72 73 74
}

/**
 * Register the default timezone for the application. This will
 * be the default timezone used by all date functions through
 * throughout the entire application.
 */
75 76 77
$timezone = Config::get('application.timezone');

date_default_timezone_set($timezone);