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.
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.
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', [ ]);
}