Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Symfony2 Essentials

You're reading from   Symfony2 Essentials

Arrow left icon
Product type Paperback
Published in Sep 2015
Publisher
ISBN-13 9781784398767
Length 158 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

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:
    db_driver: orm
    firewall_name: main
    user_class: AppBundle\Entity\User

Add this to the config.yml file in the imports section. Also, since this bundle is using translations, we need to enable...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image