当前位置: 首页>>代码示例>>PHP>>正文


PHP AutoloaderFactory::factory方法代码示例

本文整理汇总了PHP中Zend\Loader\AutoloaderFactory::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP AutoloaderFactory::factory方法的具体用法?PHP AutoloaderFactory::factory怎么用?PHP AutoloaderFactory::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Loader\AutoloaderFactory的用法示例。


在下文中一共展示了AutoloaderFactory::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initAutoloader

 protected static function initAutoloader()
 {
     $vendorPath = static::findParentPath('vendor');
     if (file_exists($vendorPath . '/autoload.php')) {
         $loader = (include $vendorPath . '/autoload.php');
     }
     if (class_exists('Zend\\Loader\\AutoloaderFactory')) {
         return;
     }
     $zf2Path = false;
     if (getenv('ZF2_PATH')) {
         // Support for ZF2_PATH environment variable
         $zf2Path = getenv('ZF2_PATH');
     } elseif (get_cfg_var('zf2_path')) {
         // Support for zf2_path directive value
         $zf2Path = get_cfg_var('zf2_path');
     }
     if ($zf2Path) {
         if (isset($loader)) {
             $loader->add('Zend', $zf2Path);
             $loader->add('ZendXml', $zf2Path);
         } else {
             include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
             Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true)));
         }
     }
 }
开发者ID:antarus,项目名称:mystra-pve,代码行数:27,代码来源:Bootstrap.php

示例2: initAutoloader

 protected static function initAutoloader()
 {
     $vendorPath = static::findParentPath('vendor');
     // Include composer autoloader
     // TODO Make a Zend PSR-4 autoloader?
     include $vendorPath . '/autoload.php';
     // Locate ZF2 path.
     $zf2Path = getenv('ZF2_PATH');
     if (!$zf2Path) {
         if (defined('ZF2_PATH')) {
             $zf2Path = ZF2_PATH;
         } elseif (is_dir($vendorPath . '/ZF2/library')) {
             $zf2Path = $vendorPath . '/ZF2/library';
         } elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) {
             $zf2Path = $vendorPath . '/zendframework/zendframework/library';
         }
     }
     if (!$zf2Path) {
         throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
     }
     // Set up ZF2 autoloader to find itself and the test classes.
     include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
     $autoloadOptions = array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__)));
     AutoloaderFactory::factory($autoloadOptions);
 }
开发者ID:bvarent,项目名称:doc-block-tags,代码行数:25,代码来源:Bootstrap.php

示例3: autoload

 /**
  * @throws \Exception
  */
 protected static function autoload()
 {
     if (file_exists('vendor/autoload.php')) {
         $loader = (require 'vendor/autoload.php');
     }
     // the entire application is based on Composer loader, but just in case
     // let's instantiate the loader if I can't find Composer's ClassLoader
     if (empty($loader)) {
         switch (true) {
             case file_exists('vendor/zendframework/zendframework/library/Zend/Loader/AutoloaderFactory.php'):
                 require_once 'vendor/zendframework/zendframework/library/Zend/Loader/AutoloaderFactory.php';
                 \Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'fallback_autoloader' => true)));
                 require_once 'vendor/zendframework/zendframework/library/Zend/Loader/StandardAutoloader.php';
                 $loader = \Zend\Loader\AutoloaderFactory::getRegisteredAutoloader('Zend\\Loader\\StandardAutoloader');
                 break;
                 // @TODO: case file_exists('path/to/Symfony/Loader.php') / Implement when you'll need it
             // @TODO: case file_exists('path/to/Symfony/Loader.php') / Implement when you'll need it
             default:
                 throw new \Exception('Could not find neither Zend nor Composer or Symfony libraries for creating a class loader!');
         }
     }
     // register Netis only. The real class loader will be instantiated inside the Application classes
     switch (true) {
         case $loader instanceof \Zend\Loader\SplAutoloader:
             $loader->registerPrefix('Netis', 'vendor/athemcms/Netis/library/Netis');
             break;
         case $loader instanceof \Composer\Autoload\ClassLoader:
             $loader->add('Netis', 'vendor/athemcms/netis/library');
             break;
             // @TODO: Implement Symfony when you'll need it as well :D
         // @TODO: Implement Symfony when you'll need it as well :D
         default:
             throw new \Exception('No Loader detected!');
     }
 }
开发者ID:athemcms,项目名称:netis,代码行数:38,代码来源:ApplicationFactory.php

示例4: initAutoloader

    protected static function initAutoloader()
    {
        $vendorPath = static::findParentPath('vendor');

        if (is_readable($vendorPath . '/autoload.php')) {
            $loader = include $vendorPath . '/autoload.php';
            return;
        }

        $zf2Path = getenv('ZF2_PATH') ?: (defined('ZF2_PATH') ? ZF2_PATH : (is_dir($vendorPath . '/ZF2/library') ? $vendorPath . '/ZF2/library' : false));

        if (!$zf2Path) {
            throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
        }

        if (isset($loader)) {
            $loader->add('Zend', $zf2Path . '/Zend');
        } else {
            include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
            AutoloaderFactory::factory(array(
                'Zend\Loader\StandardAutoloader' => array(
                    'autoregister_zf' => true,
                    'namespaces' => array(
                        'ZF\Configuration' => __DIR__ . '/../src/',
                        __NAMESPACE__ => __DIR__,
                    ),
                ),
            ));
        }
    }
开发者ID:jbarentsen,项目名称:drb,代码行数:30,代码来源:Bootstrap.php

示例5: initAutoloader

 protected static function initAutoloader()
 {
     $vendorPath = static::findParentPath('vendor');
     $zf2Path = getenv('ZF2_PATH');
     if (!$zf2Path) {
         if (defined('ZF2_PATH')) {
             $zf2Path = ZF2_PATH;
         } elseif (is_dir($vendorPath . '/ZF2/library')) {
             $zf2Path = $vendorPath . '/ZF2/library';
         } elseif (is_dir($vendorPath . '/zendframework/zendframework/library')) {
             $zf2Path = $vendorPath . '/zendframework/zendframework/library';
         }
     }
     if (!$zf2Path) {
         throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or' . ' define a ZF2_PATH environment variable.');
     }
     if (file_exists($vendorPath . '/autoload.php')) {
         include $vendorPath . '/autoload.php';
     }
     include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
     $namespaces = array(__NAMESPACE__ => __DIR__);
     $modulePath = self::findParentPath('module');
     if ($handle = opendir(static::findParentPath('src/module'))) {
         while (false !== ($file = readdir($handle))) {
             if (substr($file, 0, 1) != '.') {
                 $namespaces[$file] = $modulePath . '/' . $file . '/src/' . $file;
                 $namespaces[$file . 'Test'] = $modulePath . '/' . $file . '/test/' . $file . 'Test';
             }
         }
         closedir($handle);
     }
     AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => $namespaces)));
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:33,代码来源:Bootstrap.php

示例6: initAutoloader

 protected static function initAutoloader()
 {
     $vendorPath = static::findParentPath('vendor');
     if (file_exists($vendorPath . '/autoload.php')) {
         include $vendorPath . '/autoload.php';
     }
     AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
 }
开发者ID:uthando-cms,项目名称:uthando-news,代码行数:8,代码来源:Bootstrap.php

示例7: initAutoloader

 protected static function initAutoloader()
 {
     $vendorPath = static::findParentPath('vendor');
     if (file_exists($vendorPath . '/autoload.php')) {
         include $vendorPath . '/autoload.php';
     }
     include $vendorPath . '/zendframework/zend-loader/src/AutoloaderFactory.php';
     AutoloaderFactory::factory(['Zend\\Loader\\StandardAutoloader' => ['autoregister_zf' => true, 'namespaces' => [__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__]]]);
 }
开发者ID:saeven,项目名称:phpspec-zf2,代码行数:9,代码来源:ZendFramework2Extension.php

示例8: __invoke

 /**
  * @param \Zend\Module\ModuleEvent $e
  * @return void
  */
 public function __invoke(ModuleEvent $e)
 {
     $module = $e->getModule();
     if (!$module instanceof AutoloaderProvider) {
         return;
     }
     $autoloaderConfig = $module->getAutoloaderConfig();
     AutoloaderFactory::factory($autoloaderConfig);
 }
开发者ID:rikaix,项目名称:zf2,代码行数:13,代码来源:AutoloaderListener.php

示例9: index7Action

 public function index7Action()
 {
     \Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\ClassMapAutoloader' => array(LIBRARY_PATH . '/../../../Autoloader/Autoloader.php', LIBRARY_PATH . '/../../../Autoloader/classmap.php')));
     $student = new \Database\Student();
     $teacher = new \Database\Teacher();
     $worker = new \Database\Oracle\Worker();
     $upload = new \File\Abc\Upload();
     return false;
 }
开发者ID:htam261,项目名称:zendskeleton,代码行数:9,代码来源:AutoloaderController.php

示例10: __invoke

 /**
  * @param  ModuleEvent $e
  * @return void
  */
 public function __invoke(ModuleEvent $e)
 {
     $module = $e->getModule();
     if (!$module instanceof AutoloaderProviderInterface && !method_exists($module, 'getAutoloaderConfig')) {
         return;
     }
     $autoloaderConfig = $module->getAutoloaderConfig();
     AutoloaderFactory::factory($autoloaderConfig);
 }
开发者ID:Baft,项目名称:Zend-Form,代码行数:13,代码来源:AutoloaderListener.php

示例11: initAutoloader

 protected static function initAutoloader()
 {
     \Zend\Loader\AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true)));
     $smConfig = new ServiceManagerConfig([]);
     $serviceManager = new ServiceManager();
     $smConfig->configureServiceManager($serviceManager);
     $serviceManager->setService('ApplicationConfig', include __DIR__ . '/config/application.config.php');
     $serviceManager->get('ModuleManager')->loadModules();
     static::$serviceManager = $serviceManager;
 }
开发者ID:buse974,项目名称:address,代码行数:10,代码来源:bootstrap.php

示例12: initAutoloader

 protected static function initAutoloader()
 {
     $vendorPath = static::findParentPath('vendor');
     if (is_readable($vendorPath . '/autoload.php')) {
         $loader = (include $vendorPath . '/autoload.php');
     } else {
         throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install`.');
     }
     AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true, 'namespaces' => array(__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__))));
 }
开发者ID:leloulight,项目名称:Cornerstone,代码行数:10,代码来源:Bootstrap.php

示例13: initAutoloader

 protected static function initAutoloader()
 {
     $vendorPath = static::findParentPath('vendor');
     if (file_exists($vendorPath . '/autoload.php')) {
         include $vendorPath . '/autoload.php';
     }
     if (!class_exists('Zend\\Loader\\AutoloaderFactory')) {
         throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install`');
     }
     AutoloaderFactory::factory(['Zend\\Loader\\StandardAutoloader' => ['autoregister_zf' => true, 'namespaces' => [__NAMESPACE__ => __DIR__ . '/' . __NAMESPACE__]]]);
 }
开发者ID:shitikovkirill,项目名称:LearnZF2,代码行数:11,代码来源:Bootstrap.php

示例14: execute

 public static function execute()
 {
     include 'init_autoloader.php';
     define('ZF2_PATH', realpath('vendor/zendframework/zendframework/library'));
     $path = array(ZF2_PATH, get_include_path());
     set_include_path(implode(PATH_SEPARATOR, $path));
     require_once 'Zend/Loader/AutoloaderFactory.php';
     require_once 'Zend/Loader/StandardAutoloader.php';
     // setup autoloader
     AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array(StandardAutoloader::AUTOREGISTER_ZF => true, StandardAutoloader::ACT_AS_FALLBACK => false, StandardAutoloader::LOAD_NS => array('Admin\\Infra' => getcwd() . '/module/Admin/src/Admin/Infra', 'Admin\\Domain' => getcwd() . '/module/Admin/src/Admin/Domain'))));
 }
开发者ID:rzorzal,项目名称:MyZend2Skeleton,代码行数:11,代码来源:Bootstrap.php

示例15: registerZf2Autoloader

 protected function registerZf2Autoloader()
 {
     $options = $this->getOptions();
     if (!empty($options['zf2_path'])) {
         include_once $options['zf2_path'] . '/Zend/Loader/AutoloaderFactory.php';
     }
     if (!class_exists('Zend\\Loader\\AutoloaderFactory', true)) {
         throw new DomainException('Option "zf2Path" was not provided');
     }
     AutoloaderFactory::factory(array('Zend\\Loader\\StandardAutoloader' => array('autoregister_zf' => true)));
 }
开发者ID:grizzm0,项目名称:zf2-for-1,代码行数:11,代码来源:Zf2.php


注:本文中的Zend\Loader\AutoloaderFactory::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。