rinatio / facebook
v0.1
2013-10-14 22:17 UTC
Requires
- php: >=5.3
- guzzle/guzzle: ~3.6
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2024-12-16 15:44:16 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()