title: Autoloading Zend Framework 2 packages with the StandardAutoloader
body: <p>I was previously using a downloaded version of Zend Framework 2 and was basically able to do something like this:</p>
  
  <pre><code>// Set include paths (add Zend to the path)
  set_include_path(get_include_path() . PATH_SEPARATOR . $__CONFIG['zendPath']);
  
  // Setup the Zend Autoloader
  require_once('library\Zend\Loader\StandardAutoloader.php');
  
  $autoLoader = new StandardAutoloader(array(
      'namespaces' =&gt; array(
          'Zend' =&gt; $__CONFIG['zendPath'] . '/library/Zend'
      )
  ));
  </code></pre>
  
  <p>This works because all Zend packages are inside the library folder. I now wanted to use composer to load only the Zend packages I need. The problem I'm running into is that the packages get arranged in the following way:</p>
  
  <pre><code>zendframework/zend-cache/Zend/...
  zendframework/zend-loader/Zend/...
  zendframework/zend-validator/Zend/...
  etc.
  </code></pre>
  
  <p>I tried having separate namespace declarations in the StandardAutoloader like this:</p>
  
  <pre><code>$autoLoader = new StandardAutoloader(array(
      'namespaces' =&gt; array(
          'Zend\Cache' =&gt; $__CONFIG['zendPath'] . '/library/zend-cache/Zend/Cache',
          'Zend\Loader' =&gt; $__CONFIG['zendPath'] . '/library/zend-loader/Zend/Loader',
          'Zend\Validator' =&gt; $__CONFIG['zendPath'] . '/library/zend-validator/Zend/Validator'
      )
  ));
  </code></pre>
  
  <p>That doesn't work. Am assuming the namespace probably can't have the backslashes in it? is there any way to make this work? Preferably without having to define each individual package.</p>