symfony3 Configuration No HTTP interface needed ?


Example

If your application does not need any HTTP interface (for example for a console only app), you will want to disable at least Twig and SensioFrameworkExtra

Just comment out those lines:

app/AppKernel.php

$bundles = [
//...
//    new Symfony\Bundle\TwigBundle\TwigBundle(),
//    new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
//...
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
//...
//    $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();

app/config/config.yml

framework:
#    ...
#    router:
#        resource: '%kernel.root_dir%/config/routing.yml'
#        strict_requirements: ~
#    ...
#    templating:
#        engines: ['twig']
#...
#twig:
#    debug: '%kernel.debug%'
#    strict_variables: '%kernel.debug%'

app/config/config_dev.yml

#framework:
#    router:
#        resource: '%kernel.root_dir%/config/routing_dev.yml'
#        strict_requirements: true
#    profiler: { only_exceptions: false }

#web_profiler:
#    toolbar: true
#    intercept_redirects: false

You can also remove the related vendor requirements from composer.json:

"sensio/framework-extra-bundle": "x.x.x",
"twig/twig": "x.x"

Using Symfony at all in such case is arguable, but at least it can be temporary.