Skip to content

Commit 69351a5

Browse files
committed
Merge remote-tracking branch 'upstream/master'
Conflicts: src/base_facebook.php
2 parents 1d083d8 + 41e6c4f commit 69351a5

File tree

9 files changed

+4229
-312
lines changed

9 files changed

+4229
-312
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
/coverage/
2+
vendor/
3+
composer.lock
4+
composer.phar

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ language: php
22
php:
33
- 5.3
44
- 5.4
5+
- 5.5
56
script: phpunit --stderr --bootstrap tests/bootstrap.php tests/tests.php

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"ext-curl": "*",
1717
"ext-json": "*"
1818
},
19+
"require-dev": {
20+
"phpunit/phpunit": "3.7.*"
21+
},
1922
"autoload": {
2023
"classmap": ["src"]
2124
}

examples/example.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
if ($user) {
4747
$logoutUrl = $facebook->getLogoutUrl();
4848
} else {
49+
$statusUrl = $facebook->getLoginStatusUrl();
4950
$loginUrl = $facebook->getLoginUrl();
5051
}
5152

@@ -76,6 +77,10 @@
7677
<?php if ($user): ?>
7778
<a href="<?php echo $logoutUrl; ?>">Logout</a>
7879
<?php else: ?>
80+
<div>
81+
Check the login status using OAuth 2.0 handled by the PHP SDK:
82+
<a href="<?php echo $statusUrl; ?>">Check the login status</a>
83+
</div>
7984
<div>
8085
Login using OAuth 2.0 handled by the PHP SDK:
8186
<a href="<?php echo $loginUrl; ?>">Login with Facebook</a>

readme.md

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Facebook PHP SDK (v.3.2.0)
2-
==========================
1+
Facebook PHP SDK (v.3.2.2)
32

43
The [Facebook Platform](http://developers.facebook.com/) is
54
a set of APIs that make your app more social.
@@ -15,41 +14,63 @@ Usage
1514

1615
The [examples][examples] are a good place to start. The minimal you'll need to
1716
have is:
17+
```php
18+
require 'facebook-php-sdk/src/facebook.php';
1819

19-
require 'facebook-php-sdk/src/facebook.php';
20+
$facebook = new Facebook(array(
21+
'appId' => 'YOUR_APP_ID',
22+
'secret' => 'YOUR_APP_SECRET',
23+
));
2024

21-
$facebook = new Facebook(array(
22-
'appId' => 'YOUR_APP_ID',
23-
'secret' => 'YOUR_APP_SECRET',
24-
));
25-
26-
// Get User ID
27-
$user = $facebook->getUser();
25+
// Get User ID
26+
$user = $facebook->getUser();
27+
```
2828

2929
To make [API][API] calls:
30-
31-
if ($user) {
32-
try {
33-
// Proceed knowing you have a logged in user who's authenticated.
34-
$user_profile = $facebook->api('/me');
35-
} catch (FacebookApiException $e) {
36-
error_log($e);
37-
$user = null;
38-
}
39-
}
30+
```php
31+
if ($user) {
32+
try {
33+
// Proceed knowing you have a logged in user who's authenticated.
34+
$user_profile = $facebook->api('/me');
35+
} catch (FacebookApiException $e) {
36+
error_log($e);
37+
$user = null;
38+
}
39+
}
40+
```
4041

4142
Login or logout url will be needed depending on current user state.
42-
43-
if ($user) {
44-
$logoutUrl = $facebook->getLogoutUrl();
45-
} else {
46-
$loginUrl = $facebook->getLoginUrl();
47-
}
48-
49-
[examples]: http://github.com/facebook/facebook-php-sdk/blob/master/examples/example.php
43+
```php
44+
if ($user) {
45+
$logoutUrl = $facebook->getLogoutUrl();
46+
} else {
47+
$loginUrl = $facebook->getLoginUrl();
48+
}
49+
```
50+
51+
With Composer:
52+
53+
- Add the `"facebook/php-sdk": "@stable"` into the `require` section of your `composer.json`.
54+
- Run `composer install`.
55+
- The example will look like
56+
57+
```php
58+
if (($loader = require_once __DIR__ . '/vendor/autoload.php') == null) {
59+
die('Vendor directory not found, Please run composer install.');
60+
}
61+
62+
$facebook = new Facebook(array(
63+
'appId' => 'YOUR_APP_ID',
64+
'secret' => 'YOUR_APP_SECRET',
65+
));
66+
67+
// Get User ID
68+
$user = $facebook->getUser();
69+
```
70+
71+
[examples]: /examples/example.php
5072
[API]: http://developers.facebook.com/docs/api
5173

52-
5374
Tests
5475
-----
5576

0 commit comments

Comments
 (0)