4

I have read the Symfony documentation and I am still unsure of how to include a class. I want to include a Google Analytics PHP class into Symfony, but not sure on the following:

  1. Where should it go? From the documentation I assume it should be under the vendor directory?
  2. How would I then include the class? Ideally I would only like to include it where necessary (ie when I need it).
  3. How would I then utilise the class?

Cheers

Adam

1 Answer 1

6

Use the app/autoload.php file to configure your autoload mechanism.

If your class doesn't follow PEAR style conventions or PSR-0 standards then you should plainly require it (as is the case with Swiftmailer in the same file)

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.