title: Can i use Symfony's Route Annotation in Non-Symfony Project
body: <p>I already tried things here <a href="https://symfony.com/doc/master/components/routing.html" rel="nofollow noreferrer">https://symfony.com/doc/master/components/routing.html</a>
  But i couldn't make it.</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  use Doctrine\Common\Annotations\AnnotationReader;
  use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
  use Symfony\Component\Config\FileLocator;
  use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader;
  use Composer\Autoload\ClassLoader;
  use Doctrine\Common\Annotations\AnnotationRegistry;
  
  /** @var ClassLoader $loader */
  $loader = require __DIR__.'/vendor/autoload.php';
  
  AnnotationRegistry::registerLoader([$loader, 'loadClass']);
  
  $loader = new AnnotationDirectoryLoader(
      new FileLocator(__DIR__.'/app/Controller/'),
      new AnnotatedRouteControllerLoader(
          new AnnotationReader()
      )
  );
  
  $routes = $loader-&gt;load(__DIR__.'/app/Controller/');
  </code></pre>
  
  <p>When i do that i get these mistakes</p>
  
  <pre class="lang-php prettyprint-override"><code>Fatal error: Uncaught Error: Class 'Symfony\Component\Config\Loader\FileLoader' not found in C:\xampp\htdocs\MyFw\vendor\symfony\routing\Loader\AnnotationFileLoader.php:25 Stack trace: #0 C:\xampp\htdocs\MyFw\vendor\composer\ClassLoader.php(444): include() #1 C:\xampp\htdocs\MyFw\vendor\composer\ClassLoader.php(322): Composer\Autoload\includeFile('C:\\xampp\\htdocs...') #2 [internal function]: Composer\Autoload\ClassLoader-&gt;loadClass('Symfony\\Compone...') #3 C:\xampp\htdocs\MyFw\vendor\symfony\routing\Loader\AnnotationDirectoryLoader.php(23): spl_autoload_call('Symfony\\Compone...') #4 C:\xampp\htdocs\MyFw\vendor\composer\ClassLoader.php(444): include('C:\\xampp\\htdocs...') #5 C:\xampp\htdocs\MyFw\vendor\composer\ClassLoader.php(322): Composer\Autoload\includeFile('C:\\xampp\\htdocs...') #6 [internal function]: Composer\Autoload\ClassLoader-&gt;loadClass('Symfony\\Compone...') #7 C:\xampp\htdocs\MyFw\index.php(14): spl_autoload_call('Symfony\\Compone...') #8 {main} thrown in C:\xampp\htdocs\MyFw\vendor\symfony\routing\Loader\AnnotationFileLoader.php on line 25
  
  </code></pre>