rinatio/facebook

Installs: 9

Dependents: 0

Stars: 1

Watchers: 1

Language: PHP

v0.1 2013-10-14 22:17 UTC

README

This is a wrapper for Facebook Test User API. It allows you to create, read, update and delete Facebook test users in OOP style.

Installation

You can install it through composer with this command:

$ php composer.phar require --dev rinatio/Facebook:~0.1

After installing, you need to require Composer's autoloader:

require 'vendor/autoload.php';

Usage

Load namespaced classes like this:

use rinatio\Facebook\Test\User as TestUser;
use rinatio\Facebook\Facebook;

Define your Facebook application credentials:

Facebook::setAppId('fbAppId');
Facebook::setAppSecret('fbAppSecret');

Now you're ready to go. Here are some examples

Create a new users:

$user1 = TestUser::create(array(
    'name' => 'Butch Cassidy'
));

Fetch user's profile

$user2 = TestUser::create(array(
    'name' => 'Etta Place'
));
$user2->fetchProfile();
echo $user2->first_name; // outputs 'Etta'

Get all test users created for application:

$users = TestUser::all();

Change user's name or password:

$user2->update(array(
    'name' => 'Sundance Kid'
))

Add friends connection:

$user1->addFriend($user2);

Delete user:

$user1->delete();

Or delete all users:

TestUser::deleteAll()