Abstracting Facebook API functions#78
Conversation
|
This abstracts the process of performing same basic tasks through Facebook API, such as retrieving user information and publishing posts as the user to user's own stream or as a Facebook page to a user controlled page. If there is interest to add this functionality to FOSFacebookBundle, pleaser feel free. Justification would be that it is often a basic functionality that you use Facebook connectivity on a site for and it can be occasionally annoying and time consuming to follow the api changes of Facebook or learn how to do this functionality on your own. I'd find it easier to have it centralized in one place and if anything changes, you'll need to change your code only in one place (this bundle) and the developer would not necessarily need to know the specifics how the Fb api actually works. How sending a message works is you create a container object for the message, call a service to handle the sending and order it to post the message. Example: $streamPost = new fosStreamPost();
$streamPost->setMessage("Hello world");
// optional image
$streamPost->setAttachment("my image name", "caption text", "http://image_url...");
$facebookPush = $this->get("fos_facebook.facebook_push");
// send to user stream
$facebookPush->publishStream($streamPost);
// or facebook page
$facebookPush->publishPage($streamPost, "pageid"); |
No description provided.