From d79154b3612ec5c79c2fd81adf3ee40b53f83c69 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 13 Dec 2020 20:34:09 +0100 Subject: Initial commit --- Readme.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Readme.md (limited to 'Readme.md') diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..f3fc3b7 --- /dev/null +++ b/Readme.md @@ -0,0 +1,37 @@ +# guzzle-cardmarket-api-middleware + +to use with the [Cardmarket API](https://api.cardmarket.com/ws/documentation) + +## Installation +``` +composer require drogueronin/guzzle-cardmarket-api-middleware +``` + +## How to use + +```php +use GuzzleHttp\Client; +use GuzzleHttp\HandlerStack; +use CardmarketApi\OAuthMiddleware; + +// Create default HandlerStack +$stack = HandlerStack::create(); + +// Add this middleware to the top with `push` +$stack->push(new OAuthMiddleware(), 'oauth'); + +// Initialize the client with the handler option and cardmarket oauth data +$client = new Client([ + 'handler' => $stack, + 'base_uri' => 'https://api.cardmarket.com/ws/v2.0/output.json/', + 'cardmarket' => [ + 'app_token' => 'your_app_token', + 'app_secret' => 'your_app_secret', + 'access_token' => 'your_access_token', + 'access_token_secret' => 'your_access_token_secret', + ], +]); + +// Request a resource +$response = $client->get('account'); +``` -- cgit v1.2.3