Symfony Flex is a Composer plugin already installed with Symfony.
composer create-project symfony/skeleton flex
cd flex/


# Twig is not the name of a Composer package (it is a Flex alias).  
# Flex resolves that alias for Composer.  

# Flex installs a recipe for symfony/twig-bundle.  
# A recipe is a way for a library to automatically configure itself.  

composer require twig
composer require profiler
composer require api

composer remove api
composer remove vendor/package

symfony server:start
http://localhost:8000   # Welcome to Symfony


Twig is a fast and secure template engine for PHP.
 * DefaultController
 * src/Controller/DefaultController
 * Starting from Symfony 5.0 support for PHP templates was removed.
 * Only Twig templates can be used.
 * http://localhost:8000/hello              # Hello WORLD
 * http://localhost:8000/hello/Symfony      # Hello SYMFONY

namespace App\Controller;

use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class DefaultController extends AbstractController 
     * @Route("/hello/{name}")
    public function hello($name='World')
        return $this->render('default/index.html.twig', [
            'name' => $name,


Twig compiles templates down to plain optimized PHP code.
<!-- templates/default/index.html.twig -->

{% include 'header.html.twig' %}

<b>Hello name|upper</b>

  Last update: 297 days ago