Symfony Interview Questions

Symfony 2 interview questions

Top 15 Symfony interview questions and answers these Symfony interview questions are designed for Symfony Programmers who are preparing for an interview on Symfony Framework.

Here you can find basic Symfony interview questions that may be asked by an interviewer in Symfony interviews. Read the below Symfony interview Questions and Good Luck for your interview. If you have more interview questions on the Symfony framework, Please post it in the comment section it helps other Symfony Programmer to crack their interview. Thanks and best of Luck for your interview :)

Quick Questions About Symfony

is written In PHP language
Symfony is a Web application framework and a set of PHP reusable components/libraries.
Symfony is developed By Fabien Potencier
Latest version Symfony 4
Symfony Dependencies Composer, JSON enabled ,ctype enabled, PHP 5.5.9 or later etc
Symfony Licence under MIT License
Current Stable release 4.2.7

Symfony Framework Interview Questions

1) What is Symfony?

Symfony is a set of PHP Components and a leading PHP framework to create websites and dynamic web applications. It follows the MVC design pattern and released under the MIT License.

Also Read: Top differences between Symfony and Laravel PHP Framework

2) Is Symfony is open sourced Framework?

Yes, Symfony is open sourced Framework released under the MIT License. You can download it free from https://symfony.com/download

3) What is the latest version of Symfony?List server requirements to install it?

Symfony 3.4 is the latest version of Symfony.

To install and run Symfony 3, your server must fulfill the following requirements

  • PHP >= 5.5.9
  • Composer
  • JSON enabled
  • ctype enabled
  • date.timezone should be set (default timezone will not work)

4) Which template engine Symfony Supports?

Symfony default template engine is Twig, however, your are free to use plain PHP code if you want.

5) What are bundles in Symfony?

Symfony bundle are very similar to plugins or packages in other frameworks or CMS. In Symfony, everything is a bundle from core framework components to code you write.The bundle gives the flexibility to use pre-built features packaged in third-party bundles or to create and distribute your own bundles.

There are two types of bundles are available in Symfony :

  1. Application-specific bundles: only used to build your application.
  2. Reusable bundles: meant to be shared across many projects.

6) Is Symfony is configuration or convention based Framework?

Symfony is convention based Framework.
Also Read 100 Best Laravel Interview Questions

7) How to get the current route in Symfony Framework?

You can get the current route in Symfony using the $request->get(‘_route’); method.

8) How to get the list of all installed packages in composer?

composer show command is used to list all installed packages/dependencies of your current project.

9) How to set and get Session in Symfony2?

SessionInterface object set and get method is used to set and get sessions in Symfony2.Below look below example:

public function sessionAction(SessionInterface $session)
    // store an attribute for reuse during a later user request
    $session->set('user_id', 5);

    // get the attribute set by another controller in another request
    $user_id = $session->get('user_id');  

10) How to get the request parameters in symfony2?

$request->query->get(‘paraemeter_name’) method is used to get the request parameters in symfony2.

11) What is the method name in the Kernel class to enable bundles in Symfony?

Kernel’s class registerBundles() method is used to enable bundles in Symfony.

12) What are Descriptors in Symfony?

Descriptors are objects to render documentation on Symfony Console Apps.

13) Do bundles have fixed directory structure in Symfony?


14) What Rules do you follow at the time of creating methods within the controller in Symfony?

General rules for creating a method in within the controller in Symfony.
  • Only action methods should be public.
  • Controller methods should be short; if your controller is long, consider refactoring it.
  • Action methods must have the “Action” suffix
  • Action methods should return a valid response object

15) How to Create a Symfony Application using Composer?

Run below command in your console to install Symfony using Composer
composer create-project symfony/framework-standard-edition my_project_name

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.