View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFPROP:Proposal Zone Template}

[My Name|]


1.1 - 28 April 2011: Second Draft.

Zend_Service_Facebook provides an easy to API to Facebook's API and model-classes, without using facebook's own class.

* [Facebook|]
* [Facebook SDK|]

*Component will be configurable (AppId, secret, ...)
*Component will be able to check if user is logged in
*Component will be able to redirect to log in window
*Component will be able to check if user is lo
*Component will be able to perform http calls to facebook's api
*Component will be able to provide model objects for all types of facebook objects

* Zend_Exception
* Zend_Http_Client
* Zend_JSON

The Component can be used to query facebook's graph api to get information about different type of facebook objects, like users, albums, ...
It should act as a facade to the api. Stuff like $facebookUser = $facebook->getUser('userId') will provide an easy way to access the api. In addition return data will be presented in model objects with generic getters.

* Milestone 1: Write object factory class
* Milestone 2: Write object classes
* Milestone 3: Write facebook access classes
* Milestone 4: Unit tests exist, work, and are checked into SVN.
* Milestone 5: Documentation exists.


||UC-01||Facebook API can be queried
||UC-02||Facebook login window is presented if user has to log in
||UC-03||Data will be parsed an returned properly

class Zend_Service_Facebook_Object_Factory
* types
const TYPE_ALBUM = 'Album';
const TYPE_APPLICATION = 'Application';
const TYPE_CHECKIN = 'Checkin';
const TYPE_COMMENT = 'Comment';
const TYPE_EVENT = 'Event';
const TYPE_FRIENDLIST = 'FriendList';
const TYPE_GROUP = 'Group';
const TYPE_INSIGHTS = 'Insights';
const TYPE_LINK = 'Link';
const TYPE_MESSAGE = 'Message';
const TYPE_NOTE = 'Note';
const TYPE_PAGE = 'Page';
const TYPE_PHOTO = 'Photo';
const TYPE_POST = 'Post';
const TYPE_REVIEW = 'Review';
const TYPE_STATUS_MESSAGE = 'StatusMessage';
const TYPE_SUBSCRIPTION = 'Subscription';
const TYPE_THREAD = 'Thread';
const TYPE_USER = 'User';
const TYPE_VIDEO = 'Video';

* factory for factory objects
* @param string $type
* @param array $data
* @return Facebook_Object_ObjectAbstract
* @throws Facebook_Exception
public static function factory($type, array $data)
// get constants of the class itself to check if type is correct
$reflection = new Zend_Reflection_Class(__CLASS__);
if (!in_array($type, $reflection->getConstants())) {
throw new Facebook_Exception('Type of Object is incorrect');

$className = 'Facebook_Object_' . $type;

if (!class_exists($className)) {
throw new Facebook_Exception('Class "' . $className . '" could not be instantiated.');

return new $className($data);

class Zend_Service_Facebook
public function __construct(ZendConfig $config)


class Zend_Service_Facebook_Object_ObjectAbstract implements Facebook_Object_Interface

class Zend_Service_Facebook_Object_Album extends Facebook_Object_ObjectAbstract