Updated README to keep ordering of index.php.
[zf2.biz/galerie.git] / README.md
1 ZendSkeletonApplication
2 =======================
3
4 Introduction
5 ------------
6 This is a simple, skeleton application using the ZF2 MVC layer and module
7 systems. This application is meant to be used as a starting place for those
8 looking to get their feet wet with ZF2.
9
10
11 Installation
12 ------------
13
14 Using Composer (recommended)
15 ----------------------------
16 The recommended way to get a working copy of this project is to clone the repository
17 and use composer to install dependencies:
18
19     cd my/project/dir
20     git clone git://github.com/zendframework/ZendSkeletonApplication.git
21     cd ZendSkeletonApplication
22     php composer.phar install
23
24 Using Git submodules
25 --------------------
26 Alternatively, you can install using native git submodules. This method works fine but it is
27 recommended that you use Composer due to the dependency management it provides.
28
29     git clone git://github.com/zendframework/ZendSkeletonApplication.git --recursive
30
31 You will also need to update public/index.php and modules/Application/Module.php to enable autoloading.
32 For public/index.php, replace lines 2-13 with:
33
34     use Zend\Loader\AutoloaderFactory,
35         Zend\ServiceManager\ServiceManager,
36         Zend\Mvc\Service\ServiceManagerConfiguration;
37
38     chdir(dirname(__DIR__));
39     require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php';
40
41     // Setup autoloader
42     AutoloaderFactory::factory();
43
44 For modules/Application/Module.php add:
45
46     public function getAutoloaderConfig()
47     {
48         return array(
49             'Zend\Loader\ClassMapAutoloader' => array(
50                 __DIR__ . '/autoload_classmap.php',
51             ),
52             'Zend\Loader\StandardAutoloader' => array(
53                 'namespaces' => array(
54                     __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
55                 ),
56             ),
57         );
58     }
59
60 Afterwards, set up a virtual host to point to the public/ directory of the
61 project and you should be ready to go!