> From: abod...@gmail.com
> Date: Sat, 4 Aug 2012 09:31:17 +0200
> To: bullfrogbl...@live.com
> CC: fw-general@lists.zend.com
> Subject: Re: [fw-general] Getting Started with Zend Framework 2
> 
> On Sat, Aug 4, 2012 at 12:06 AM, Gerry - <bullfrogbl...@live.com> wrote:
> 
> > Ok. I think I understand. I can use composer to do autoloading, thus
> > elimating the getAutoloaderConfig() methods in modules?
> >
> 
> Yes - if you're talking about private modules that are used only by you, or
> you commit to _always_ using composer (today and in the future)
> 
> No - if your modules will be used in other projects (yours or public) or in
> the future you might stop using composer. getAutoloaderConfig() registers
> spl autoloader that are shipped with ZF2, so this method will always work
> in plain PHP and ZF 2.0, 2.1, 2.2 etc. and maybe even in 3.0. Also there is
> no harm in having both - if you installed the module via composer, composer
> autoloader will be used. If the composer autoloader is not present (or
> cannot find the class), ZF2 autoloader will come in to finish the job....
> all that assuming you have had getAutoloaderConfig() present.
> 
> 
> 
> 
> -- 
>       __
>      /.)\   +48 695 600 936
>      \(./   abod...@gmail.com


Ok. So the recommendation is that each module ensure that it can be autoloaded 
by taking advantage of getAutoloaderConfig(), then autoloading will work with 
or without composer. 

If you install composer you can configure composer to autoload modules and 
generally speaking, the composer autoloader will be hit first, falling back to 
the module autoloader, falling back to zf. I'm assuming that the zf autoloader 
in this case can be configured in the same way that the composer autoloader is. 
Nonetheless, modules should still ensure themselves that they can be autoloaded 
as a best practice for flexibility across different environments, etc.

So the flow of autoloading is: composer -> module (via getAutoloaderConfig()) 
-> zf (base/fallback).

I cloned the ZSkeletonApp rather download the zip, then ran the composer 
install and noticed an empty `vendor/ZF2` folder. I'm assuming that if I clone 
recursivly or use git to init & update the submodules zf will be cloned into 
that ZF2 directory and that composer installing zf in a different directory is 
intentional. 
The directory structure for the zf install by composer is unnecessary too. Is 
there any reasoning to it? A shorter one would have made more sense to me i.e. 
`/vendor/zf/library/...` oppose to 
`/vendor/zendframework/zendframework/library/...`.

--
Gerry
                                          

Reply via email to