I'm trying to grasp how to include a PSR-0 enabled external library on my Symfony2 project. In "The PSR-0 Class Loader" page (here: http://symfony.com/doc/master/components/class_loader/class_loader.html").
Which file is being edited? If it's app/autoloader.php, mine looks different than what's being presented:
use Doctrine\Common\Annotations\AnnotationRegistry;
use Composer\Autoload\ClassLoader;
/**
* @var $loader ClassLoader
*/
$loader = require __DIR__.'/../vendor/autoload.php';
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
Do I have to include this code before return? Or it should be in the other files being called? Still if it's app/autoload.php, shouldn't this code:
// register several namespaces at once
$loader->addPrefixes(array(
'Symfony' => __DIR__.'/../vendor/symfony/symfony/src',
'Monolog' => __DIR__.'/../vendor/monolog/monolog/src',
));
be addNamespaces instead? and once I succeed in declaring this library how do I use it?