@@ -6,18 +6,14 @@ PHP client for connecting to the Bigcommerce V2 REST API.
6
6
To find out more, visit the official documentation website:
7
7
http://developer.bigcommerce.com/
8
8
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
-
13
9
[ ![ Latest Stable Version] ( https://poser.pugx.org/bigcommerce/api/v/stable.png )] ( https://packagist.org/packages/bigcommerce/api )
14
10
[ ![ Total Downloads] ( https://poser.pugx.org/bigcommerce/api/downloads.png )] ( https://packagist.org/packages/bigcommerce/api )
15
11
16
12
Requirements
17
13
------------
18
14
19
- - PHP 7.0 or greater
20
- - cUrl extension enabled
15
+ - PHP 7.1 or greater
16
+ - ` curl ` extension enabled
21
17
22
18
To generate an OAuth API token, [ follow this guide.] ( https://support.bigcommerce.com/s/article/Store-API-Accounts )
23
19
@@ -70,7 +66,6 @@ for connecting to a store on the Bigcommerce platform:
70
66
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.
71
67
72
68
~~~ php
73
-
74
69
$object = new \stdClass();
75
70
$object->client_id = 'xxxxxx';
76
71
$object->client_secret = 'xxxxx';
@@ -81,21 +76,20 @@ $object->scope = $request->get('scope');
81
76
82
77
$authTokenResponse = Bigcommerce::getAuthToken($object);
83
78
84
- Bigcommerce::configure(array(
79
+ Bigcommerce::configure([
85
80
'client_id' => 'xxxxxxxx',
86
81
'auth_token' => $authTokenResponse->access_token,
87
82
'store_hash' => 'xxxxxxx'
88
- ));
89
-
83
+ ]);
90
84
~~~
91
85
92
86
### Basic Auth (deprecated)
93
87
~~~ php
94
- Bigcommerce::configure(array(
88
+ Bigcommerce::configure([
95
89
'store_url' => 'https://store.mybigcommerce.com',
96
90
'username' => 'admin',
97
91
'api_key' => 'd81aada4xc34xx3e18f0xxxx7f36ca'
98
- ) );
92
+ ] );
99
93
~~~
100
94
101
95
Connecting to the store
@@ -155,7 +149,7 @@ If you require more specific numbering and paging, you can explicitly specify
155
149
a limit parameter:
156
150
157
151
~~~ php
158
- $filter = array(" page" => 3, " limit" => 30) ;
152
+ $filter = [' page' => 3, ' limit' => 30] ;
159
153
160
154
$products = Bigcommerce::getProducts($filter);
161
155
~~~
@@ -164,7 +158,7 @@ To filter a collection, you can also pass parameters to filter by as key-value
164
158
pairs:
165
159
166
160
~~~ php
167
- $filter = array(" is_featured" => true) ;
161
+ $filter = [' is_featured' => true] ;
168
162
169
163
$featured = Bigcommerce::getProducts($filter);
170
164
~~~
@@ -179,7 +173,7 @@ To update a single resource:
179
173
~~~ php
180
174
$product = Bigcommerce::getProduct(11);
181
175
182
- $product->name = " MacBook Air" ;
176
+ $product->name = ' MacBook Air' ;
183
177
$product->price = 99.95;
184
178
$product->update();
185
179
~~~
@@ -188,10 +182,10 @@ You can also update a resource by passing an array or stdClass object of fields
188
182
you want to change to the global update method:
189
183
190
184
~~~ php
191
- $fields = array(
192
- " name" => " MacBook Air" ,
193
- " price" => 999.95
194
- ) ;
185
+ $fields = [
186
+ ' name' => ' MacBook Air' ,
187
+ ' price' => 999.95
188
+ ] ;
195
189
196
190
Bigcommerce::updateProduct(11, $fields);
197
191
~~~
@@ -204,9 +198,9 @@ can be done by passing an array or stdClass object representing the new
204
198
resource to the global create method:
205
199
206
200
~~~ php
207
- $fields = array(
208
- " name" => " Apple"
209
- ) ;
201
+ $fields = [
202
+ ' name' => ' Apple'
203
+ ] ;
210
204
211
205
Bigcommerce::createBrand($fields);
212
206
~~~
@@ -217,7 +211,7 @@ and calling the create method once you have set the fields you want to save:
217
211
~~~ php
218
212
$brand = new Bigcommerce\Api\Resources\Brand();
219
213
220
- $brand->name = " Apple" ;
214
+ $brand->name = ' Apple' ;
221
215
$brand->create();
222
216
~~~
223
217
@@ -265,11 +259,11 @@ objects. An example transaction using XML would look like:
265
259
~~~ php
266
260
Bigcommerce::useXml();
267
261
268
- $xml = " <?xml version =" 1.0" encoding =" UTF-8" ?>
262
+ $xml = ' <?xml version =" 1.0" encoding =" UTF-8" ?>
269
263
<brand >
270
264
<name >Apple</name >
271
265
<search _keywords >computers laptops</search _keywords >
272
- </brand >" ;
266
+ </brand >' ;
273
267
274
268
$result = Bigcommerce::createBrand($xml);
275
269
~~~
@@ -343,5 +337,5 @@ need to configure the client to recognize this. Provide the URL of the proxy
343
337
server and (optionally) a port to the useProxy method:
344
338
345
339
~~~ php
346
- Bigcommerce::useProxy(" http://proxy.example.com" , 81);
340
+ Bigcommerce::useProxy(' http://proxy.example.com' , 81);
347
341
~~~
0 commit comments