File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,16 @@ composer require chillerlan/php-oauth
9595Note: replace ` dev-main ` with a [ version constraint] ( https://getcomposer.org/doc/articles/versions.md#writing-version-constraints ) , e.g. ` ^1.0 ` - see [ releases] ( https://github.com/chillerlan/php-oauth/releases ) for valid versions.
9696
9797
98+ ## Examples
99+
100+ There is [ the suite of get-token examples] ( https://php-oauth.readthedocs.io/en/main/Usage/Using-examples.html ) ,
101+ which is mostly intended for development, and there are self-contained examples for a quickstart:
102+
103+ - [ OAuth1 example] ( https://github.com/chillerlan/php-oauth/tree/main/examples/example-oauth1.php )
104+ - [ OAuth2 example] ( https://github.com/chillerlan/php-oauth/tree/main/examples/example-oauth2.php )
105+
106+
107+
98108# Implemented Providers
99109
100110<!-- TABLE-START -->
Original file line number Diff line number Diff line change @@ -284,7 +284,10 @@ class MyOAuth2Provider extends OAuth2Provider implements TokenInvalidate{
284284 * ...
285285 */
286286
287- protected function sendTokenInvalidateRequest(string $url, array $body){
287+ protected function sendTokenInvalidateRequest(
288+ string $url,
289+ array $body,
290+ ):ResponseInterface{
288291
289292 $request = $this->requestFactory
290293 ->createRequest('POST', $url)
@@ -298,7 +301,10 @@ class MyOAuth2Provider extends OAuth2Provider implements TokenInvalidate{
298301 return $this->http->sendRequest($request);
299302 }
300303
301- protected function getInvalidateAccessTokenBodyParams(AccessToken $token, string $type):array{
304+ protected function getInvalidateAccessTokenBodyParams(
305+ AccessToken $token,
306+ string $type,
307+ ):array{
302308 return [
303309 // here, client_id and client_secret are set additionally
304310 'client_id' => $this->options->key,
@@ -322,7 +328,10 @@ class MyOAuth2Provider extends OAuth2Provider implements TokenInvalidate{
322328 * ...
323329 */
324330
325- public function invalidateAccessToken(AccessToken|null $token = null, string|null $type = null):bool{
331+ public function invalidateAccessToken(
332+ AccessToken|null $token = null,
333+ string|null $type = null,
334+ ):bool{
326335
327336 // a token was given
328337 if($token !== null){
Original file line number Diff line number Diff line change 22
33OAuth is not exactly trivial, and so is live testing an OAuth flow to make sure the implementation and all its details work as expected.
44The examples - specifically [ the get-token examples] ( https://github.com/chillerlan/php-oauth/tree/main/examples/get-token ) -
5- are abstracted and condensed as far as possible to make using them as convenient as it can get.
5+ are abstracted and condensed to make using them as convenient as possible.
6+
7+ There are also 2 self-contained, fully working examples to illustrate the whole implementation without any overhead:
8+
9+ - [ OAuth1 example] ( https://github.com/chillerlan/php-oauth/tree/main/examples/example-oauth1.php )
10+ - [ OAuth2 example] ( https://github.com/chillerlan/php-oauth/tree/main/examples/example-oauth2.php )
611
712
813## Requirements
You can’t perform that action at this time.
0 commit comments