PageRenderTime 14ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/readme.md

http://github.com/facebook/php-sdk
Markdown | 85 lines | 57 code | 28 blank | 0 comment | 0 complexity | 11360463fe7ac7f3d61e4656c3587ec1 MD5 | raw file
 1We have created a new repository for this project: https://github.com/facebook/facebook-php-sdk.  Please update anything you have pointing at this repostory to this location before April 1, 2012.
 2
 3Facebook PHP SDK (v.3.1.1)
 4==========================
 5
 6The [Facebook Platform](http://developers.facebook.com/) is
 7a set of APIs that make your app more social
 8
 9This repository contains the open source PHP SDK that allows you to access Facebook Platform from your PHP app. Except as otherwise noted, the Facebook PHP SDK
10is licensed under the Apache Licence, Version 2.0
11(http://www.apache.org/licenses/LICENSE-2.0.html)
12
13
14Usage
15-----
16
17The [examples][examples] are a good place to start. The minimal you'll need to
18have is:
19
20    require 'facebook-php-sdk/src/facebook.php';
21
22    $facebook = new Facebook(array(
23      'appId'  => 'YOUR_APP_ID',
24      'secret' => 'YOUR_APP_SECRET',
25    ));
26
27    // Get User ID
28    $user = $facebook->getUser();
29
30To make [API][API] calls:
31
32    if ($user) {
33      try {
34        // Proceed knowing you have a logged in user who's authenticated.
35        $user_profile = $facebook->api('/me');
36      } catch (FacebookApiException $e) {
37        error_log($e);
38        $user = null;
39      }
40    }
41
42Login or logout url will be needed depending on current user state.
43
44    if ($user) {
45      $logoutUrl = $facebook->getLogoutUrl();
46    } else {
47      $loginUrl = $facebook->getLoginUrl();
48    }
49
50[examples]: http://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php
51[API]: http://developers.facebook.com/docs/api
52
53
54Tests
55-----
56
57In order to keep us nimble and allow us to bring you new functionality, without
58compromising on stability, we have ensured full test coverage of the SDK.
59We are including this in the open source repository to assure you of our
60commitment to quality, but also with the hopes that you will contribute back to
61help keep it stable. The easiest way to do so is to file bugs and include a
62test case.
63
64The tests can be executed by using this command from the base directory:
65
66    phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php
67
68
69Contributing
70===========
71For us to accept contributions you will have to first have signed the [Contributor License Agreement](https://developers.facebook.com/opensource/cla).
72
73When commiting, keep all lines to less than 80 characters, and try to follow the existing style.
74
75Before creating a pull request, squash your commits into a single commit.
76
77Add the comments where needed, and provide ample explanation in the commit message.
78
79
80Report Issues/Bugs
81===============
82[Bugs](https://developers.facebook.com/bugs)
83
84[Questions](http://facebook.stackoverflow.com)
85