O'Reilly logo

Symfony2 Essentials by Wojciech Bancer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Installing the user manager bundle

While Symfony2 has some basic user handling, there is a very popular bundle, FOSUserBundle, created by the Friends of Symfony group. In the first chapter, we added this bundle to the composer, but now, we need to properly install and configure it.

First, we need to add the bundle to app/AppKernel.php as follows:

            /* ... */
            new AppBundle\AppBundle(),
            new FOS\UserBundle\FOSUserBundle(),
        );

We need to add configuration to this. You can directly add this to your app/config/config.yml file or create a separate file for this and import the resource. Creating a separate file makes it easier to manage, and sometimes to copy to other projects.

Let's create the app/config/fos/user.yml file with the following content:

fos_user: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required