How to get the root dir of the Symfony2 application?
UPDATE 2018-10-21: As of this week, getRootDir() was deprecated. Please use getProjectDir() instead, as suggested in the comment section by Muzaraf Ali. —- Use this: $this->get(‘kernel’)->getRootDir(); And if you want the web root: $this->get(‘kernel’)->getRootDir() . ‘/../web’ . $this->getRequest()->getBasePath(); this will work from controller action method… EDIT: As for the services, I think the way you … Read more