sopinet / userbundle
Easy integration sample, fosuser+hwi_oauth+sonatauser for Symfony2
Installs: 472
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 6
Forks: 2
Type:symfony-bundle
Requires
- php: >=5.3.3
- friendsofsymfony/user-bundle: 1.3.*
This package is not auto-updated.
Last update: 2025-01-04 16:57:22 UTC
README
Easy Integration:
hwi_oauth: https://github.com/hwi/HWIOAuthBundle
fosub: https://github.com/FriendsOfSymfony/FOSUserBundle
Optional (sonatauser & sonataadmin): https://github.com/sonata-project/SonataUserBundle
What it is?
This bundle integrate fosub + hwi_oauth with default options and configuration for only work. You can use it as documentation, guide or use directly in your site.
Installation
From composer, add
{ "require": { "sopinet/userbundle": "dev-master" } }
Add bundle to AppKernel (you can need add FOSUB and SonataUserBundle too)
new Sopinet\UserBundle\SopinetUserBundle(),
Configuration
- Add configuration / security file by default:
imports - { resource: "@SopinetUserBundle/Resources/config/config.yml" }
instead of if you want the same login page for admin and users, then you must import this one:
imports - { resource: "@SopinetUserBundle/Resources/config/same_login_config.yml" }
- Add your id and secret parameters:
parameters: sopinet_user_facebook_id: "YOURID-FACEBOOK" sopinet_user_facebook_secret: "YOURSECRET-FACEBOOK" sopinet_user_google_id: "YOURID-GOOGLE" sopinet_user_google_secret: "YOURSECRET-GOOGLE"
- It work with SonataUserBundle, overriding user class in app, so, you must have configure integration with FOSUB+SonataUser
fos_user: db_driver: orm firewall_name: main user_class: Application\Sonata\UserBundle\Entity\User
- In your Application\Sonata\UserBundle\Entity\User you must have one field ProfilePicture:
/** @ORM\Column(name="profilepicture", type="string", length=500, nullable=true) */ protected $profilepicture; /** * Set profilepicture * * @param string $profilepicture * @return User */ public function setProfilePicture($profilepicture) { $this->profilepicture = $profilepicture; return $this; } /** * Get profilepicture * * @return string */ public function getProfilePicture() { return $this->profilepicture; }
And it must be defined in User.orm.xml
<field name="profilepicture" column="profilepicture" type="string" length="500" nullable="true"></field>
Usage
<a href="{{ hwi_oauth_login_url('google') }}">Connect with Google</a> <a href="{{ hwi_oauth_login_url('facebook') }}">Connect with Facebook</a>