How do you enable a class in symfony2?

I read the symfony documentation and I still don't know how to enable the class. I want to include the Google Analytics PHP class in Symfony, but I'm not sure about the following:

  • Where should he go? From the documentation, I assume that it should be under the supplier's directory?
  • How to include a class? Ideally, I would like to include it where necessary (i.e. when I need it).
  • How could I use a class?

Greetings

Adam

+4
source share
1 answer

Use the app/autoload.php to configure the startup mechanism.

If your class does not comply with PEAR style conventions or PSR-0 standards, you should explicitly require it (as is the case with Swiftmailer in the same file)

If your class follows the PEAR conventions, you should use the registerPrefixes else method, if your class follows the PSR-0 standard (maybe not), you should use the registerNamespaces method

+6
source

All Articles