ZF2: When would you use autoload_classmap.php
zend-framework2
Solution
What is a classmap used for?
A classmap is basically a functionality for your application to load all relevant classes faster. This is due to the fact that every single class is assigned the full filepath and filename. Other than the standard autoloader which only maps namespaces to directories.
Why not use it during development?
The answer is simple: constantly renewing the classmap during development phase is a huge p.i.t.a. Just use the standard autoloader during development and once your module is finished, create the classmap and use it. You'll notice a slight speed boost.
Are there alternatives to using ZF2s classmap?
Yes there are. Other than having multiple classmaps for all modules it's even better if you just create ONE ENORMOUS CLASSMAP for all modules, vendor modules, libraries, etc... The solution to this is called `composer`
Problem
Reading through the zf2 getting start guide and I was confused about this part: *As we are in development, we don’t need to load files via the classmap, so we provide an empty array for the classmap autoloader. Create a file called autoload_classmap.php under zf2-tutorial/module/Album:* ``` <?php return array(); ``` Why don't we need autoload_classmap because we are in development? I read the doc on autoload_classmap.php, but still don't understand what its really for and why it would be necessary in production.