Created
August 18, 2014 06:23
-
-
Save adrolter/9b94e2f2292586702495 to your computer and use it in GitHub Desktop.
More flexible bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dirSep = DIRECTORY_SEPARATOR; | |
$boltRoot = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..'); | |
$autoloaderPaths = array( | |
'Standard' => $boltRoot . $dirSep . 'vendor' . $dirSep . 'autoload.php', | |
'Composer' => $boltRoot . $dirSep . '..' . $dirSep . '..' . $dirSep . 'autoload.php'; | |
); | |
foreach ($autoloaderPaths as $name => $path) { | |
if (file_exists($path)) { | |
require_once $path; | |
$configClass = 'Bolt\\Configuration\\' . $name; | |
$config = new $configClass($boltRoot); | |
break; | |
} | |
} | |
if (!isset($config) || !$config instanceof \Bolt\Configuration\ResourceManager) { | |
throw new Exception('Autoloader not found or configuration class instantiation failed.'); | |
} | |
$config->verify(); | |
$config->compat(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment