Symfony 2 interview questions and Answers
Most Frequently Asked Symfony 2 interview questions
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.
- 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
composer create-project symfony/framework-standard-edition ProjectName "2.7.*"
// You Can mention here you particular version that you want to install
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
{
}
$requestName = $this->container->get('request');
$currentRoute = $requestName->get('_route');
$request = $this->container->get('request');
$parameter1 = $request->query->get('parameter1');
public function indexAction()
{
return $this->render('user/login.html.twig', [ ]);
}