Symfony 2 interview questions and Answers

Last update: 15 Mar 2022, 9 Questions

Most Frequently Asked Symfony 2 interview questions

Here in this article, we will be listing frequently asked Symfony 2 interview questions and Answers with the belief that they will be helpful for you to gain higher marks. Also, to let you know that this article has been written under the guidance of industry professionals and covered all the current competencies.

1. What is Symfony 2 and explain its advantages?

Symfony2 is embracing high standards. It is centered around HTTP specification and PHP standards. These standards make Symfony2 interoperable with amazing PHP libraries. Using the Dependency Injection (DI) pattern, the framework has a built-in DI Container, which makes it flexible and easy to customize.

0 0
2. Explain the innovations in Symfony2?
  • It uses the Dependency Injection pattern.
  • It is packaged as Distributions
  • In Symfony2, Everything is a Bundle.
  • It eases the debugging of your application.
  • It takes Security very seriously
0 0
3. Please write the steps to install Symfony2 using composer?

composer create-project symfony/framework-standard-edition ProjectName "2.7.*"

// You Can mention here you particular version that you want to install

0 0
4. How to create Controllers in Symfony2?

Controller's file default location is src/AppBundle/Controller Now you can create here your controller with below code.



namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class YourControllerName extends Controller


0 0
5. How to get current route name in Symfony?

$requestName = $this->container->get('request');
$currentRoute = $requestName->get('_route');

0 0
6. How to get the parameters from URL's in symfony2?

$request = $this->container->get('request');
$parameter1 = $request->query->get('parameter1');

0 0
7. Symfony support which template engine? Symfony supports default template engine is Twig, but ever, you are free to use plain PHP code if you want.
0 0
9. How to create Controllers's Action in Symfony2? In your created controller you can create your action with the following code.



public function indexAction()
     return $this->render('user/login.html.twig', [ ]);

0 0
About Umesh Singh
Umesh Singh
Full Stack Developer

My name is Umesh Singh having 7+ experience in Node.JS, React JS, PHP, Laravel, WordPress, MySQL, JavaScript, HTML and CSS etc. I have worked on around 20+ projects. I love programming, coding and most of my time goes in learning the best ways to write clean code. When I am not found coding, I can be seen helping out tech geeks. I am always open to help you.