@@ -49,11 +49,11 @@ To install this, you can either download the .zip or .tar and extract it or use
4949
5050#### Composer
5151
52- 1 . Add "samuelthomas2774/oauth-client": "~ 2.1 .0" to your composer.json.
52+ 1 . Add "samuelthomas2774/oauth-client": "~ 2.2 .0" to your composer.json.
5353 ``` json
5454 {
5555 "require" : {
56- "samuelthomas2774/oauth-client" : " ~2.1 .0"
56+ "samuelthomas2774/oauth-client" : " ~2.2 .0"
5757 }
5858 }
5959
@@ -75,17 +75,7 @@ Default (OAuth2)
7575
7676 *Or*
7777
78- If you are using composer, add "samuelthomas2774/oauth-client": "2.1.*" to the require object in your composer.json.
79- Then, include vendor/autoload.php in all pages that need access to any provider.
80- ```json
81- {
82- "require" : {
83- "samuelthomas2774/oauth-client" : " 2.1.*"
84- }
85- }
86-
87- ```
88-
78+ If you are using composer, include vendor/autoload.php in all pages that need access to any provider.
8979 ```php
9080 require_once __DIR__ . '/oauth-client/src/autoload.php';
9181
@@ -103,14 +93,11 @@ Default (OAuth2)
10393 ```php
10494 $client_id = "appid";
10595 $client_secret = "appsecret";
106- $oauth = new OAuth2(
107- $client_id, $client_secret,
108- $options = Array(
109- " dialog" => Array("base_url" => "https://facebook.com/dialog/oauth"),
110- " api" => Array("base_url" => "https://graph.facebook.com/v2.2"),
111- " requests" => Array("/oauth/token" => "/oauth/access_token")
112- )
113- );
96+ $oauth = new OAuth2($client_id, $client_secret, $options = Array(
97+ " dialog" => Array("base_url" => "https://facebook.com/dialog/oauth"),
98+ " api" => Array("base_url" => "https://graph.facebook.com/v2.2"),
99+ " requests" => Array("/oauth/token" => "/oauth/access_token")
100+ ));
114101
115102 ```
116103
@@ -194,6 +181,7 @@ You can also use these methods in extended classes (subclasses).
194181
195182Built-in providers
196183------------
184+
197185Any other providers please contact me at https://samuelthomas.ml/about/contact and I'll add it as soon as possible.
198186
199187**Provider** | **Class** | **File in /src** | **Sign-up url**
@@ -214,6 +202,7 @@ WordPress.com `U` | OAuthWordPress | wordpress.class.php | https:
214202Eventbrite `U` | OAuthEventbrite | eventbrite.class.php | https://www.eventbrite.co.uk/myaccount/apps/new/
215203
216204All the built-in providers above have an extra method, userProfile `U`, that returns the user's data in an object:
205+
217206```php
218207try { $user = $oauth->userProfile(); }
219208catch(Exception $error) { exit("OAuth Provider returned an error: " . print_r($error, true)); }
@@ -223,6 +212,7 @@ catch(Exception $error) { exit("OAuth Provider returned an error: " . print_r($e
223212```
224213
225214Some also have a profilePicture method ` P ` , that returns the user's profile picture and an < ; img /> ; tag:
215+
226216``` php
227217try { $picture = $oauth->userProfile(); }
228218catch(Exception $error) { exit("OAuth Provider returned an error: " . print_r($error, true)); }
@@ -232,6 +222,7 @@ catch(Exception $error) { exit("OAuth Provider returned an error: " . print_r($e
232222```
233223
234224#### Facebook
225+
235226The OAuthFacebook class has some additional methods:
236227
237228- To parse a signed request sent from Facebook when the page is loaded in a page tab or Facebook Canvas:
@@ -316,6 +307,7 @@ The OAuthFacebook class has some additional methods:
316307 ```
317308
318309#### samuelthomas.ml
310+
319311- To get all storage objects:
320312 ```php
321313 try { $objects = $oauth->objects(); }
@@ -355,8 +347,9 @@ The OAuthFacebook class has some additional methods:
355347
356348 ```
357349
358- Extending the OAuth2 class.
350+ Extending the OAuth2 class
359351------------
352+
360353You can extend the OAuth2 and other classes to add new functions and make existing functions work differently:
361354
362355```php
0 commit comments