1- ___________________________________
2-
3- Light PHP wrapper for the OAuth 2.0
4- ___________________________________
1+ # Light PHP wrapper for the OAuth 2.0
52
3+ [ ![ Latest Stable Version] ( https://poser.pugx.org/adoy/fastcgi-client/v/stable )] ( https://packagist.org/packages/adoy/fastcgi-client )
4+ [ ![ GitHub] ( https://img.shields.io/github/license/adoy/PHP-OAuth2 )] ( LICENSE )
5+ [ ![ Total Downloads] ( https://poser.pugx.org/adoy/fastcgi-client/downloads )] ( https://packagist.org/packages/adoy/fastcgi-client )
66
7- AUTHOR & CONTACT
8- ================
97
10- Charron Pierrick
11- - pierrick@webstart.fr
8+ ## How can I use it ?
129
13- Berejeb Anis
14- - anis.berejeb@gmail.com
15-
16-
17- DOCUMENTATION & DOWNLOAD
18- ========================
19-
20- Latest version is available on github at :
21- - https://github.com/adoy/PHP-OAuth2
22-
23- Documentation can be found on :
24- - https://github.com/adoy/PHP-OAuth2
25-
26-
27- LICENSE
28- =======
29-
30- This Code is released under the GNU LGPL
31-
32- Please do not change the header of the file(s).
33-
34- This library is free software; you can redistribute it and/or modify it
35- under the terms of the GNU Lesser General Public License as published
36- by the Free Software Foundation; either version 2 of the License, or
37- (at your option) any later version.
38-
39- This library is distributed in the hope that it will be useful, but
40- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
41- or FITNESS FOR A PARTICULAR PURPOSE.
42-
43- See the GNU Lesser General Public License for more details.
44-
45-
46- How can I use it ?
47- ==================
10+ ``` php
11+ <?php
4812
4913require('Client.php');
5014require('GrantType/IGrantType.php');
7337 $response = $client->fetch('https://graph.facebook.com/me');
7438 var_dump($response, $response['result']);
7539}
40+ ```
7641
77- How can I add a new Grant Type ?
78- ================================
79- Simply write a new class in the namespace OAuth2\GrantType. You can place the class file under GrantType.
42+ ## How can I add a new Grant Type ?
43+
44+ Simply write a new class in the namespace OAuth2\GrantType. You can place the class file under GrantType.
8045Here is an example :
8146
47+ ``` php
48+ <?php
49+
8250namespace OAuth2\GrantType;
8351
8452/**
85- * MyCustomGrantType Grant Type
53+ * MyCustomGrantType Grant Type
8654 */
8755class MyCustomGrantType implements IGrantType
8856{
8957 /**
9058 * Defines the Grant Type
91- *
92- * @var string Defaults to 'my_custom_grant_type'.
59+ *
60+ * @var string Defaults to 'my_custom_grant_type'.
9361 */
9462 const GRANT_TYPE = 'my_custom_grant_type';
9563
9664 /**
9765 * Adds a specific Handling of the parameters
98- *
66+ *
9967 * @return array of Specific parameters to be sent.
10068 * @param mixed $parameters the parameters array (passed by reference)
10169 */
@@ -111,7 +79,27 @@ class MyCustomGrantType implements IGrantType
11179 }
11280 }
11381}
82+ ```
11483
115- call the OAuth client getAccessToken with the grantType you defined in the GRANT_TYPE constant, As following :
84+ call the OAuth client getAccessToken with the grantType you defined in the GRANT_TYPE constant, As following :
85+
86+ ```
11687$response = $client->getAccessToken(TOKEN_ENDPOINT, 'my_custom_grant_type', $params);
88+ ```
89+
90+ ## LICENSE
91+
92+ This Code is released under the GNU LGPL
11793
94+ Please do not change the header of the file(s).
95+
96+ This library is free software; you can redistribute it and/or modify it
97+ under the terms of the GNU Lesser General Public License as published
98+ by the Free Software Foundation; either version 2 of the License, or
99+ (at your option) any later version.
100+
101+ This library is distributed in the hope that it will be useful, but
102+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
103+ or FITNESS FOR A PARTICULAR PURPOSE.
104+
105+ See the GNU Lesser General Public License for more details.
0 commit comments