@@ -6,18 +6,14 @@ PHP client for connecting to the Bigcommerce V2 REST API.
66To find out more, visit the official documentation website:
77http://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
1612Requirements
1713------------
1814
19- - PHP 7.0 or greater
20- - cUrl extension enabled
15+ - PHP 7.1 or greater
16+ - ` curl ` extension enabled
2117
2218To 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:
7066In 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
10195Connecting to the store
@@ -155,7 +149,7 @@ If you require more specific numbering and paging, you can explicitly specify
155149a 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
164158pairs:
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
188182you 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
196190Bigcommerce::updateProduct(11, $fields);
197191~~~
@@ -204,9 +198,9 @@ can be done by passing an array or stdClass object representing the new
204198resource to the global create method:
205199
206200~~~ php
207- $fields = array(
208- " name" => " Apple"
209- ) ;
201+ $fields = [
202+ ' name' => ' Apple'
203+ ] ;
210204
211205Bigcommerce::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
266260Bigcommerce::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
343337server 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~~~
0 commit comments