Question: What is Symfony?
Symfony is a PHP framework and a set of reusable components/libraries.
Question: What is current Stable version of Symfony?
Version: 3.2.7, Dated: 5 April 2017
Question: What is offical website URL of Symfony?
http://www.symfony.com
Question: What is offical Github URL of Symfony?
https://github.com/symfony/symfony
Question: What are the benefits of Symfony?
- Low performance overhead
- Robust Applications
- Speed up the creation and maintenance
- Unlimited flexibility
Question: What are the innovations in Symfony2?
- Symfony2 uses the Dependency Injection pattern.
- Symfony2 is packaged as Distributions
- Everything is a Bundle in Symfony2.
- Symfony2 eases the debugging of your application.
- Symfony takes Security very seriously
Question: How to install Symfony2?
Create a folder and Go to in that folder using cd command.
Execute Following command
php -r "readfile('https://symfony.com/installer');" > symfony
Question: How to create controller in Symfony2?
File Location: src/AppBundle/Controller/UserController.php
Format:
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class UserController extends Controller
{
}
Question: How to create Action of controller in Symfony2?
Add following code inside UserController.php
public function indexAction()
{
return $this->render('user/index.html.twig', [ ]);
}
Question: What is format of view file?
File Location: app/Resources/views/user/index.html.twig
{% extends 'base.html.twig' %} {% block body %} Welcome to Symfony2
{# ... #} {% endblock %}
Question: How to get current route in Symfony?
$request = $this->container->get('request');
$currentRouteName = $request->get('_route');
Question: How to get current route in Symfony?
$request = $this->container->get('request');
$currentRouteName = $request->get('_route');
Question: How to get the request parameters in symfony2?
$request = $this->container->get('request');
$name=$request->query->get('name');
Question: How to var_dump variables in twig templates??
{{ dump(user) }};
