public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader')); $includePaths = (require __DIR__ . '/include_paths.php'); array_push($includePaths, get_include_path()); set_include_path(join(PATH_SEPARATOR, $includePaths)); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $map = (require __DIR__ . '/autoload_psr4.php'); foreach ($map as $namespace => $path) { $loader->setPsr4($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); return $loader; }
/** * Plant the seed of life into Kisma! * * @param array $options * * @return bool */ public static function conceive($options = array()) { // Set any passed in options... if (is_callable($options)) { $options = call_user_func($options); } // Set any application-level options passed in static::$_options = Option::merge(static::$_options, $options); // Register our faux-destructor if (false === ($_conceived = static::get(CoreSettings::CONCEPTION))) { \register_shutdown_function(function ($eventName = KismaEvents::DEATH) { \Kisma::__sleep(); EventManager::trigger($eventName); }); // Try and detect the framework being used... Detector::framework(); // We done baby! static::set(CoreSettings::CONCEPTION, true); if (null === static::get(CoreSettings::AUTO_LOADER) && class_exists('\\ComposerAutoloaderInit', false)) { static::set(CoreSettings::AUTO_LOADER, \ComposerAutoloaderInit::getLoader()); } // And let the world know we're alive EventManager::trigger(KismaEvents::BIRTH); } // Load any session data... static::__wakeup(); return $_conceived; }
public static function getLoader() { if (null !== self::$loader) { return self::$loader; } spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); $map = (require __DIR__ . '/autoload_namespaces.php'); foreach ($map as $namespace => $path) { $loader->set($namespace, $path); } $classMap = (require __DIR__ . '/autoload_classmap.php'); if ($classMap) { $loader->addClassMap($classMap); } $loader->register(true); return $loader; }
<?php if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } define('APP_SRC', dirname(__FILE__)); $root = dirname(dirname(__FILE__)); $lib = $root . DS . 'lib'; //require composer autoloader require_once $lib . DS . 'autoload.php'; //get composer loader that already has vendors loaded $loader = ComposerAutoloaderInit::getLoader(); //load application namespaces $namespaces = array_fill_keys(['Domain', 'Infrastructure', 'Test', 'Presentation'], APP_SRC); foreach ($namespaces as $namespace => $path) { $loader->add($namespace, $path); } $classes = ['TwigView' => $lib . DS . '/slim/extras/Views/TwigView.php', 'Slim_View' => $lib . DS . '/slim/slim/Slim/View.php', 'Slim_Http_Request' => $lib . DS . '/slim/slim/Slim/Http/Request.php']; $map = []; foreach ($classes as $class => $path) { if (file_exists($path)) { $map[$class] = $path; } } $loader->addClassMap($map);
<?php /* * Copyright 2004-2015, AfterLogic Corp. * Licensed under AGPLv3 license or AfterLogic license * if commercial version of the product was purchased. * See the LICENSE file for a full license statement. */ // autoload.php generated by Composer require_once __DIR__ . '/composer' . '/autoload_real.php'; return ComposerAutoloaderInit::getLoader();