Skip to content

Commit e9866a0

Browse files
authored
Merge pull request #286 from TomA-R/bump_firebase_jwt
Upgrade firebase/php-jwt
2 parents 6417a2b + 96c5ad9 commit e9866a0

File tree

4 files changed

+24
-65
lines changed

4 files changed

+24
-65
lines changed

.travis.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

README.md

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ PHP client for connecting to the Bigcommerce V2 REST API.
66
To find out more, visit the official documentation website:
77
http://developer.bigcommerce.com/
88

9-
[![Build Status](https://travis-ci.org/bigcommerce/bigcommerce-api-php.png?branch=master)](https://travis-ci.org/bigcommerce/bigcommerce-api-php)
10-
[![Coverage Status](https://coveralls.io/repos/bigcommerce/bigcommerce-api-php/badge.png?branch=master)](https://coveralls.io/r/bigcommerce/bigcommerce-api-php?branch=master)
11-
[![Dependency Status](https://www.versioneye.com/package/php--bigcommerce--api/badge.png)](https://www.versioneye.com/package/php--bigcommerce--api)
12-
139
[![Latest Stable Version](https://poser.pugx.org/bigcommerce/api/v/stable.png)](https://packagist.org/packages/bigcommerce/api)
1410
[![Total Downloads](https://poser.pugx.org/bigcommerce/api/downloads.png)](https://packagist.org/packages/bigcommerce/api)
1511

1612
Requirements
1713
------------
1814

19-
- PHP 7.0 or greater
20-
- cUrl extension enabled
15+
- PHP 7.1 or greater
16+
- `curl` extension enabled
2117

2218
To generate an OAuth API token, [follow this guide.](https://support.bigcommerce.com/s/article/Store-API-Accounts)
2319

@@ -70,7 +66,6 @@ for connecting to a store on the Bigcommerce platform:
7066
In order to obtain the auth_token you would consume `Bigcommerce::getAuthToken` method during an installation of a single-click app. Alternatively, if you already have a token, skip to `Bigcommerce::configure` and provide your credentials.
7167

7268
~~~php
73-
7469
$object = new \stdClass();
7570
$object->client_id = 'xxxxxx';
7671
$object->client_secret = 'xxxxx';
@@ -81,21 +76,20 @@ $object->scope = $request->get('scope');
8176

8277
$authTokenResponse = Bigcommerce::getAuthToken($object);
8378

84-
Bigcommerce::configure(array(
79+
Bigcommerce::configure([
8580
'client_id' => 'xxxxxxxx',
8681
'auth_token' => $authTokenResponse->access_token,
8782
'store_hash' => 'xxxxxxx'
88-
));
89-
83+
]);
9084
~~~
9185

9286
### Basic Auth (deprecated)
9387
~~~php
94-
Bigcommerce::configure(array(
88+
Bigcommerce::configure([
9589
'store_url' => 'https://store.mybigcommerce.com',
9690
'username' => 'admin',
9791
'api_key' => 'd81aada4xc34xx3e18f0xxxx7f36ca'
98-
));
92+
]);
9993
~~~
10094

10195
Connecting to the store
@@ -155,7 +149,7 @@ If you require more specific numbering and paging, you can explicitly specify
155149
a limit parameter:
156150

157151
~~~php
158-
$filter = array("page" => 3, "limit" => 30);
152+
$filter = ['page' => 3, 'limit' => 30];
159153

160154
$products = Bigcommerce::getProducts($filter);
161155
~~~
@@ -164,7 +158,7 @@ To filter a collection, you can also pass parameters to filter by as key-value
164158
pairs:
165159

166160
~~~php
167-
$filter = array("is_featured" => true);
161+
$filter = ['is_featured' => true];
168162

169163
$featured = Bigcommerce::getProducts($filter);
170164
~~~
@@ -179,7 +173,7 @@ To update a single resource:
179173
~~~php
180174
$product = Bigcommerce::getProduct(11);
181175

182-
$product->name = "MacBook Air";
176+
$product->name = 'MacBook Air';
183177
$product->price = 99.95;
184178
$product->update();
185179
~~~
@@ -188,10 +182,10 @@ You can also update a resource by passing an array or stdClass object of fields
188182
you want to change to the global update method:
189183

190184
~~~php
191-
$fields = array(
192-
"name" => "MacBook Air",
193-
"price" => 999.95
194-
);
185+
$fields = [
186+
'name' => 'MacBook Air',
187+
'price' => 999.95
188+
];
195189

196190
Bigcommerce::updateProduct(11, $fields);
197191
~~~
@@ -204,9 +198,9 @@ can be done by passing an array or stdClass object representing the new
204198
resource to the global create method:
205199

206200
~~~php
207-
$fields = array(
208-
"name" => "Apple"
209-
);
201+
$fields = [
202+
'name' => 'Apple'
203+
];
210204

211205
Bigcommerce::createBrand($fields);
212206
~~~
@@ -217,7 +211,7 @@ and calling the create method once you have set the fields you want to save:
217211
~~~php
218212
$brand = new Bigcommerce\Api\Resources\Brand();
219213

220-
$brand->name = "Apple";
214+
$brand->name = 'Apple';
221215
$brand->create();
222216
~~~
223217

@@ -265,11 +259,11 @@ objects. An example transaction using XML would look like:
265259
~~~php
266260
Bigcommerce::useXml();
267261

268-
$xml = "<?xml version="1.0" encoding="UTF-8"?>
262+
$xml = '<?xml version="1.0" encoding="UTF-8"?>
269263
<brand>
270264
<name>Apple</name>
271265
<search_keywords>computers laptops</search_keywords>
272-
</brand>";
266+
</brand>';
273267

274268
$result = Bigcommerce::createBrand($xml);
275269
~~~
@@ -343,5 +337,5 @@ need to configure the client to recognize this. Provide the URL of the proxy
343337
server and (optionally) a port to the useProxy method:
344338

345339
~~~php
346-
Bigcommerce::useProxy("http://proxy.example.com", 81);
340+
Bigcommerce::useProxy('http://proxy.example.com', 81);
347341
~~~

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
}
1919
],
2020
"require": {
21-
"php": ">=7.1",
22-
"firebase/php-jwt": "~3.0 || ~5.0",
21+
"php": ">=8.0",
22+
"firebase/php-jwt": "~5.0 || ~6.0",
2323
"ext-curl": "*"
2424
},
2525
"require-dev": {

test/Unit/Api/ClientTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ public function testGetCustomerLoginTokenReturnsValidLoginToken()
137137
'customer_id' => 1,
138138
);
139139
$token = Client::getCustomerLoginToken(1);
140-
$actualPayload = (array)\Firebase\JWT\JWT::decode($token, 'zyx', array('HS256'));
140+
$key = new \Firebase\JWT\Key('zyx', 'HS256');
141+
$actualPayload = (array)\Firebase\JWT\JWT::decode($token, $key);
141142
foreach ($expectedPayload as $value) {
142143
$this->assertContains($value, $actualPayload);
143144
}

0 commit comments

Comments
 (0)