This project is a good start to create a website, because it contains FOSUser and FOSFacebook Bundles. Those Bundles are working together to manage users on a website.
Users can register and login traditionnaly with FOSUserBundle, and also Registering and login with Facebook. If a Facebook User doesn't exists in database, it is added. If a Facebook user's email exists in database (case of an manually previous regitered user), facebook informations are added.
This projects includes CSS and javascripts from HTMLKickStart to have a nice render at start. You are free to drop it if you don't use it. You'll have to remove css and javascript links in app/Resources/views/base.html.twig if you remove it.
A Facebook Application properly configured.
- Navigate to: https://developers.facebook.com/apps.
- Click on "Create an application" on the top right side.
- Enter a name for your application.
- Navigate to Application parameters, go in "essentials" (the first entry).
- Click on "Website with Facebook Login".
- Enter your Website's URL.
- Save Modifications.
- Download zip file from gitHub here
- Unzip it where you want
- Install Vendors:
php composer.phar install
- app/config/parameters.ini to match your own database (or eventually you can run the symfony's config.php script)
- app/config/facebookParameters.ini to match with your facebook application
; Facebook parameters for FOSFacebookBundle
[parameters]
;Enter your facebook App Id here
facebookAppID = "263778820386586"
;Enter your facebook App secret here
facebookAppSecret= "2f1efc68065669b14fedd5676d9e1672"
;Enter your facebook App url here
facebookAppUrl= "http://apps.facebook.com/263778820386586/"
;Enter your facebook server url here, as configured in your facebook app
facebookServerUrl= "http://localhost/TemplateViergeSymfony2/"
;Enter locale here (for language on the login button). Enter for exemple en_US for english, fr_FR for french etc...
;See https://www.facebook.com/translations/FacebookLocales.xml for the whole list of locales
facebookLocale= "en_US"
- create your database (if not created yet):
php app/console doctrine:database:create
- Update database:
php app/console doctrine:schema:update --force
Modify app/config/websiteParameters.ini and update parameters to match with your website
; Website parameters
[parameters]
websiteName = "Your Title Here"
websiteSlogan = "Your Slogan Here"
websiteBirthYear= "2012"
websiteUseFacebookLogin= true
You can now use this project as a normal symfony 2 project.