Download the PHP package insolis/facebook-service-provider without Composer
On this page you can find all versions of the php package insolis/facebook-service-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download insolis/facebook-service-provider
More information about insolis/facebook-service-provider
Files in insolis/facebook-service-provider
Package facebook-service-provider
Short Description Lightweight silex service to ease communication with facebook
License MIT
Informations about the package facebook-service-provider
facebook-service-provider
It's a lightweight Silex service to help creating Facebook applications.
Dependencies
It depends on two other providers:
It also uses the current request.
Configuration
It's done via the fb.options
key. It's supposed to be an array with the following keys:
app_id
: your application's idapp_secret
: your application's secret tokenpermissions
: an array with the needed permissionsredirect_route
: name of the route which is responsible for handling new user authentications
Usage
The service sets the following session keys:
fb.access_token
: the access token you can use to make requests against the graph APIfb.page_liked
: whether the current page is liked or not
A before()
middleware is registered to be run before yours. It handles two cases:
- it's a post request and we have a
signed_request
parameter: decoding is done automatically and set among the post values with thefb.data
key - it's a request for the aforementioned redirect route, and we have a
code
query parameter: fetching a token, then the user details is done automatically, set among the post values with thefb.data
key
In both cases the event fb.user_info
is dispatched, with the user data as the subject.
Events
fb.user_info
when getting user data from facebookfb.like
when the user just liked the pagefb.unlike
when the user just unliked the page
Samples
A sample application-level before
middleware to log a user in automatically:
A sample redirect route to handle new user authentications: