title: Zend Framework 2 - How to use an external library
body: <p>I want to add my custom class "Authentication.php" to my project but I don't understand how I have to do it ?</p>
  
  <p>I have read many howto about the external libs but nothing work.</p>
  
  <p>ZendFramework/module/Firewall/Module.php</p>
  
  <pre><code>class Module
  {
      public function onBootstrap(MvcEvent $e)
      {
          $eventManager        = $e-&gt;getApplication()-&gt;getEventManager();
          $moduleRouteListener = new ModuleRouteListener();
          $moduleRouteListener-&gt;attach($eventManager);
      }
  
      public function getConfig()
      {
          return include __DIR__ . '/config/module.config.php';
      }
  
      public function getAutoloaderConfig()
      {
          return array(
              'Zend\Loader\StandardAutoloader' =&gt; array(
                  'namespaces' =&gt; array(
                      __NAMESPACE__ =&gt; __DIR__ . '/src/' . __NAMESPACE__,
                      'MyNamespace' =&gt; __DIR__ . '/../../vendor/MyNamespace/lib/MyNamespace',
                  ),
              ),
          );
      }
  }
  </code></pre>
  
  <p>ZendFramework/vendor/MyNamespace/lib/MyNamespace
                                                    /Authentication.php</p>
  
  <pre><code>&lt;?php
  
  class Authentication {
  
  public function test()
  {
       die('Works fine');
  }
  
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>How I can call my external lib in my controllers.</p>
  
  <p>Thanks you very much !</p>