4 * This autoloading setup is really more complicated than it needs to be for most
5 * applications. The added complexity is simply to reduce the time it takes for
6 * new developers to be productive with a fresh skeleton. It allows autoloading
7 * to be correctly configured, regardless of the installation method and keeps
8 * the use of composer completely optional. This setup should work fine for
9 * most users, however, feel free to configure autoloading however you'd like.
12 // Composer autoloading
13 if (file_exists('vendor/autoload.php')) {
14 $loader = include 'vendor/autoload.php';
17 // Support for ZF2_PATH environment variable or git submodule
18 if ($zf2Path = getenv('ZF2_PATH') ?: (is_dir('vendor/ZF2/library') ? 'vendor/ZF2/library' : false)) {
20 $loader->add('Zend', $zf2Path . '/Zend');
22 include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
23 Zend\Loader\AutoloaderFactory::factory(array(
24 'Zend\Loader\StandardAutoloader' => array(
25 'autoregister_zf' => true
31 if (!class_exists('Zend\Loader\AutoloaderFactory')) {
32 throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');