Installing FOS User Bundle - That is not a typo!


In this video we will go through a pre-requisite for what I believe to be a real world Symfony2 with FOS OAuth Server Bundle - the installation and basic configuration of FOS User Bundle.

pro tip: feel free to skip this video if you are already confident with setting up FOS User Bundle, or have your own User implementation.

Wait Chris, what?

You're telling me that a pre-req for FOSOAuthServerBundle is FOSUserBundle?!

No, not exactly.

What I am saying is that - in my experience - on projects of sufficient scale to warrant a FOSOAuthServerBundle installation, FOSUserBundle is usually used as our user_provider.

Your mileage may vary, and of course, you are free to use whatever setup you like.

Starting Point

We are starting this series using the RESTful API we created during the How to code a Symfony 2 RESTful API with FOS REST Bundle tutorial series.

If you haven't yet watched that series, it may be worth doing so, or giving the code a once over before continuing.

We aren't doing anything OAuth-y in this video, but what we do here will have an impact almost immediately.

Why More Bundles?

One of the recent shake-ups in Symfony-land was the publishing of the Best Practices for Organising Your Bundle.

The guideline is to store everything inside one bundle - the AppBundle.

Even though I'm going ahead with a Symfony 2.6 project here, I am going to flaunt this rule in favour of what I consider to be ease of use - in the scope of this tutorial.

The inclusion of FOS User Bundle is likely already pretty controversial, and hopefully not too confusing, so to minimise the amount of crossover, I've decided to create a UserBundle and put any FOSUserBundle stuff in there, hopefully keeping the OAuth code as separate and re-usable as possible.

Again, do what's best for your project here.

Code For This Course

Get the code for this course.

Episodes