From 07f7f7754a5d38a6422c4714f24befdf9085c3e1 Mon Sep 17 00:00:00 2001 From: TheKiba Date: Tue, 21 Oct 2014 09:27:24 +0200 Subject: [PATCH 1/2] mv README to README.md --- README => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename README => README.md (100%) diff --git a/README b/README.md similarity index 100% rename from README rename to README.md From 42a0c06847687252171a4a590ea6383b3b65511d Mon Sep 17 00:00:00 2001 From: TheKiba Date: Tue, 21 Oct 2014 09:29:10 +0200 Subject: [PATCH 2/2] change README.md --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 568447b..da890eb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ - ___________________________________ - - Light PHP wrapper for the OAuth 2.0 - ___________________________________ + ___________________________________ + + Light PHP wrapper for the OAuth 2.0 + ___________________________________ AUTHOR & CONTACT @@ -46,6 +46,7 @@ See the GNU Lesser General Public License for more details. How can I use it ? ================== +``` php require('client.php'); require('GrantType/IGrantType.php'); require('GrantType/AuthorizationCode.php'); @@ -73,12 +74,14 @@ else $response = $client->fetch('https://graph.facebook.com/me'); var_dump($response, $response['result']); } +``` How can I add a new Grant Type ? ================================ Simply write a new class in the namespace OAuth2\GrantType. You can place the class file under GrantType. Here is an example : +``` php namespace OAuth2\GrantType; /** @@ -114,4 +117,4 @@ class MyCustomGrantType implements IGrantType call the OAuth client getAccessToken with the grantType you defined in the GRANT_TYPE constant, As following : $response = $client->getAccessToken(TOKEN_ENDPOINT, 'my_custom_grant_type', $params); - +```