Search code examples
phpsymfonysymfony4bundlessymfony-http-kernel

How can I find app/AppKernel.php in Symfony 4?


I want to register a bundle in the AppKernel Class in Symfony 4 according to this tutorial:

https://symfony.com/doc/3.3/bundles.html

But I do not find a folder "app", and also not the file AppKernel.php, so not the class AppKernel. Did I made a mistake by the Symfony installation or do I need to create an app folder by myself?


Solution

  • The structure of Symfony 4 is different with Symfony 3

    if you want to enable bundle in your application you must change config/bundles.php file

    something like this

        // config/bundles.php
        return [
            // 'all' means that the bundle is enabled for any Symfony environment
            Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
            Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
            Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
    .
    .
    .
    
        ];
    

    for more information see this tutorial