-[submodule "vendor/ZendFramework"]
- path = vendor/ZendFramework
- url = git://github.com/zendframework/zf2.git
+[submodule "vendor/ZF2"]
+ path = vendor/ZF2
+ url = https://github.com/zendframework/zf2.git
Using Git submodules
--------------------
-Alternatively, you can install using native git submodules. This method works fine but it is
-recommended that you use Composer due to the dependency management it provides.
+Alternatively, you can install using native git submodules:
git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive
-You will also need to update public/index.php and modules/Application/Module.php to enable autoloading.
-For public/index.php, replace lines 2-13 with:
-
- use Zend\Loader\AutoloaderFactory,
- Zend\ServiceManager\ServiceManager,
- Zend\Mvc\Service\ServiceManagerConfiguration;
-
- chdir(dirname(__DIR__));
- require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php';
-
- // Setup autoloader
- AutoloaderFactory::factory();
-
-Within modules/Application/Module.php add this method to the Application class:
-
- public function getAutoloaderConfig()
- {
- return array(
- 'Zend\Loader\StandardAutoloader' => array(
- 'namespaces' => array(
- __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
- ),
- ),
- );
- }
-
Virtual Host
------------
Afterwards, set up a virtual host to point to the public/ directory of the
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
- "zendframework/zendframework": "dev-master#c1273a4ea7ab16ecb0be1f53c211c80a27ffee9a"
+ "zendframework/zendframework": "dev-master#6bf5dfff1160e6266d8924ab6fefb678ac56f44d"
},
"autoload": {
"psr-0": {
{
return include __DIR__ . '/config/module.config.php';
}
+
+ public function getAutoloaderConfig()
+ {
+ return array(
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
+ ),
+ ),
+ );
+ }
}
chdir(dirname(__DIR__));
-// Allow using an alternative copy of ZF2
-if (getenv('ZF2_PATH')) {
- require_once getenv('ZF2_PATH') . '/Zend/Loader/AutoloaderFactory.php';
- AutoloaderFactory::factory();
+// Composer autoloading
+if (file_exists('vendor/autoload.php')) {
+ $loader = include 'vendor/autoload.php';
}
-// Composer autoloading
-if (!include_once('vendor/autoload.php')) {
- throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?');
+// Support for ZF2_PATH environment variable or git submodule
+if ($zf2Path = getenv('ZF2_PATH') ?: (is_dir('vendor/ZF2/library') ? 'vendor/ZF2/library' : false)) {
+ if (isset($loader)) {
+ $loader->add('Zend', $zf2Path . '/Zend');
+ } else {
+ include $zf2Path . '/Zend/Loader/AutoloaderFactory.php';
+ AutoloaderFactory::factory();
+ }
+}
+
+if (!class_exists('Zend\Loader\AutoloaderFactory')) {
+ throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.');
}
// Get application stack configuration
--- /dev/null
+Subproject commit 6bf5dfff1160e6266d8924ab6fefb678ac56f44d