|
Hi,
I've been following the first steps in the "Getting Started" tutorial: http://framework.zend.com/manual/2.0/en/user-guide/skeleton-application.html I downloaded the zip file of the skeleton application from github, unzipped it, and ran the commands to use Composer (self-update, install). It generates the directories vendor\zendframework\zendframework which contains the actual ZF library and there is one empty dir vendor\ZF2 Did I do something wrong? |
|
Administrator
|
-- debussy007 <[hidden email]> wrote
(on Monday, 17 September 2012, 10:08 AM -0700): > I've been following the first steps in the "Getting Started" tutorial: > http://framework.zend.com/manual/2.0/en/user-guide/skeleton-application.html > > I downloaded the zip file of the skeleton application from github, unzipped > it, and ran the commands to use Composer (self-update, install). > > It generates the directories *vendor\zendframework\zendframework* which > contains the actual ZF library and there is one empty dir *vendor\ZF2* > > Did I do something wrong? Nope, this is correct. The "vendor/ZF2/" directory is for if you decide to install ZF2 as a git submodule; it's shipped empty by default. If you install via Composer, you'll get the additional directories that Composer manages. -- Matthew Weier O'Phinney Project Lead | [hidden email] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: [hidden email] Info: http://framework.zend.com/archives Unsubscribe: [hidden email] |
|
But then how does the application find the library?
In init_autoloader.php I have the following: if (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule $zf2Path = getenv('ZF2_PATH'); } elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value $zf2Path = get_cfg_var('zf2_path'); } elseif (is_dir('vendor/ZF2/library')) { $zf2Path = 'vendor/ZF2/library'; } |
You have many options here to sort this out. Firstly you can set your environment variable to point to the vendor/zendframework/zendframework library folder. Secondly you can edit last elseif statement above to reflect your vendor/zendframework/zendframework lib. You could also install SkeletonApp as git submodule then it will work out of the box. It's all up to you really. If you're after using ZF2 lbrary only without installing any 3rd parties you could also use this: require_once 'vendor/Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory(array( 'Zend\Loader\StandardAutoloader' => array( 'autoregister_zf' => true ) )); and copyZend folder directly inside the vendor, like: vendor/Zend
Cheers,
--
Luke Mierzwa
|
|
Administrator
|
In reply to this post by debussy007
-- debussy007 <[hidden email]> wrote
(on Monday, 17 September 2012, 10:31 AM -0700): > But then how does the application find the library? It grabs it from the composer autoloader -- which is invoked in the lines above the ones you quoted below. :) // Composer autoloading if (file_exists('vendor/autoload.php')) { $loader = include 'vendor/autoload.php'; } The lines below are for when you're NOT using composer to install ZF2. In such a case, it tries to determine it: * First, from the ZF2_PATH env variable * Second, from a php.ini "zf2_path" variable * Finally, by checking to see if vendor/ZF2/library/ exists If none of those work, we don't want to try guessing anymore, and tell you we can't find it. > In init_autoloader.php I have the following: > > /if (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment > variable or git submodule > $zf2Path = getenv('ZF2_PATH'); > } elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value > $zf2Path = get_cfg_var('zf2_path'); > } *elseif (is_dir('vendor/ZF2/library')) { > $zf2Path = 'vendor/ZF2/library'; > }*/ -- Matthew Weier O'Phinney Project Lead | [hidden email] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc -- List: [hidden email] Info: http://framework.zend.com/archives Unsubscribe: [hidden email] |
| Powered by Nabble | Edit this page |
