PHPackages                             aligent/bigcommerce-api-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. aligent/bigcommerce-api-client

ActiveLibrary[API Development](/categories/api)

aligent/bigcommerce-api-client
==============================

API client for BigCommerce

v1.11.1(3y ago)1441.2k↓33.3%24[7 PRs](https://github.com/aligent/bigcommerce-v3-api-php-client/pulls)1GPL-3.0-onlyPHPPHP &gt;=7.4CI failing

Since Aug 10Pushed 1y ago16 watchersCompare

[ Source](https://github.com/aligent/bigcommerce-v3-api-php-client)[ Packagist](https://packagist.org/packages/aligent/bigcommerce-api-client)[ RSS](/packages/aligent-bigcommerce-api-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (60)Used By (1)

BigCommerce V3 Api Library
==========================

[](#bigcommerce-v3-api-library)

[![Latest Release](https://camo.githubusercontent.com/b5f93f95a845b33de648143ef9cbea470997e29f13f5951a8ebcdbe11f3ffc6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f616c6967656e742f626967636f6d6d657263652d76332d6170692d7068702d636c69656e743f736f72743d73656d766572)](https://github.com/aligent/bigcommerce-v3-api-php-client/releases)[![Packagist Latest](https://camo.githubusercontent.com/1c1775156cadcdfaa0bbb94c93840285a7b168b7e9d6757123c15c6ab657e446/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c6967656e742f626967636f6d6d657263652d6170692d636c69656e74)](https://packagist.org/packages/aligent/bigcommerce-api-client)[![Packagist PHP Version Support](https://camo.githubusercontent.com/aa9b32263cc73d162e27eb83adf38db3fa171a09e4f9cfb6aac603010eba23ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c6967656e742f626967636f6d6d657263652d6170692d636c69656e742f6465762d6d61696e)](https://camo.githubusercontent.com/aa9b32263cc73d162e27eb83adf38db3fa171a09e4f9cfb6aac603010eba23ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c6967656e742f626967636f6d6d657263652d6170692d636c69656e742f6465762d6d61696e)[![License](https://camo.githubusercontent.com/66a3c6064316af6c1f816e55b9b506511d3c5a3373903d3ad01dcbe2a4092857/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616c6967656e742f626967636f6d6d657263652d76332d6170692d7068702d636c69656e74)](https://github.com/aligent/bigcommerce-v3-api-php-client/blob/main/LICENSE.md)[![Build Status](https://camo.githubusercontent.com/69337cda7af713513f1e049a04fdbb83cf1a45de3ccf1c6eeeb4143235533720/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616c6967656e742f626967636f6d6d657263652d76332d6170692d7068702d636c69656e742f7068702e796d6c3f6272616e63683d6d61696e)](https://github.com/aligent/bigcommerce-v3-api-php-client/actions/workflows/php.yml)[![Documentation](https://camo.githubusercontent.com/535ce2c46e2ecd4c379c7b1920c1c2f8dd3696d33337088c0a0d536ff46fa370/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d67656e6572617465642d73756363657373)](https://aligent.github.io/bigcommerce-v3-api-php-client/)

Introduction
------------

[](#introduction)

This is an easy-to-use API client for [BigCommerce](https://developer.bigcommerce.com/api-reference).

Installation
------------

[](#installation)

Install [aligent/bigcommerce-api-client ](https://packagist.org/packages/aligent/bigcommerce-api-client)from packagist using [composer](https://getcomposer.org/): `composer require aligent/bigcommerce-api-client`.

Usage Examples
--------------

[](#usage-examples)

Trivial example of updating a product name:

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

$product = $api->catalog()->product(123)->get()->getProduct();
$product->name = 'Updated product name';
try {
    $api->catalog()->product($product->id)->update($product);
} catch (\Psr\Http\Client\ClientExceptionInterface $exception) {
    echo "Unable to update product: {$exception->getMessage()}";
}
```

Fetching all visible products (all pages of products):

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

$productsResponse = $api->catalog()->products()->getAllPages(['is_visible' => true]);

echo "Found {$productsResponse->getPagination()->total} products";

$products = $productsResponse->getProducts();
```

Example of updating a product variant

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

$productVariant = $api->catalog()->product(123)->variant(456)->get()->getProductVariant();
$productVariant->price = '12';

try {
    $api->catalog()->product($productVariant->product_id)->variant($productVariant->id)->update($productVariant);
} catch (\Psr\Http\Client\ClientExceptionInterface $exception) {
    echo "Unable to update product variant: {$exception->getMessage()}";
}
```

Example of creating a product variant

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

$productVariant = new \BigCommerce\ApiV3\ResourceModels\Catalog\Product\ProductVariant();
$productVariant->product_id = 123;
$productVariant->sku = "SKU-123";
//...

try {
    $api->catalog()->product($productVariant->product_id)->variants()->create($productVariant);
} catch (\Psr\Http\Client\ClientExceptionInterface $exception) {
    echo "Unable to create product variant: {$exception->getMessage()}";
}
```

### API Design

[](#api-design)

There are three components to the library:

- [BigCommerce/Api](./src/BigCommerce/Api) - which represent the API endpoints and tries to mimic the layout of the documentation.
- [BigCommerce/ResourceModels](./src/BigCommerce/ResourceModels) - which represent the resources that are sent to and received from the API, for example a `Product` or an `Order`.
- [BigCommerce/ResponseModels](./src/BigCommerce/ResponseModels) - which represent the responses from the BigCommerce API.

For additional documentation, see the [code documentation](https://aligent.github.io/bigcommerce-v3-api-php-client/).

#### API Classes

[](#api-classes)

To interact with the API, always start with the [BigCommerce\\ApiV3\\Client](./src/BigCommerce/Client.php) class. All APIs can be accessed in two ways: with and without an ID.

If you are querying about a specific resource instance (e.g. Product 5), then you would use singular endpoint ( `->catalog()->product(5)`), otherwise you would use the plural endpoint (i.e. `->catalog()->products()`).

For example, suppose we want to find all the metafields for a brand with and id of `123`. Our query is for a *specific*brand, but any metafield, so the call would look like:

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

$metafieldsResponse = $api->catalog()->brand(123)->metafields()->getAll();
$metafields = $metafieldsResponse->getMetafields();
```

Suppose we now want to delete metafield `456` on brand `123`. Now our query is for a *specific* brand and a *specific*metafield.

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

$api->catalog()->brand(123)->metafield(456)->delete();
```

#### Resource Model Classes

[](#resource-model-classes)

The resource models represent the resources we provided to the API and the responses we receive.

To create a new resource, simply instantiate a new object of the correct resource model and then send it to the create endpoint. For example, if we want to create a new brand:

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

$brand = new BigCommerce\ApiV3\ResourceModels\Catalog\Brand\Brand();
$brand->name = "My Brand";
$brand->meta_description = "My wonderful brand";

$api->catalog()->brands()->create($brand);
```

#### Response Model Classes

[](#response-model-classes)

Responses from the API all use similar response classes for consistency. There are two types generally: singular responses, and plural responses. Singular responses will have a single method in the format `get()`, for example (`ProductResponse::getProduct()`). Plural responses will have two methods, a `getPagination()`and `get()` (e.g. `ProductsResponse::getProducts()`).

Note that the API request is sent when the action is called and the response is returned.

```
$api = new BigCommerce\ApiV3\Client($_ENV['hash'], $_ENV['CLIENT_ID'], $_ENV['ACCESS_TOKEN']);

// Singular Responses
$category = $api->catalog()->category(456)->get()->getCategory();
$brand    = $api->catalog()->brand(123)->get()->getBrand();

// Plural Responses
$categoryResponse = $api->catalog()->categories()->getAll(limit: 10);
$totalCategories  = $categoryResponse->getPagination()->total;
$categories       = $categoryResponse->getCategories();

$brands = $api->catalog()->brands()->getAll()->getBrands();
```

Development
-----------

[](#development)

- Running tests: `composer run-script test`
- Checking PHP style rules: `composer run-script check-style`
- Auto fix code style rules: `composer run-script fix-style`

If you do not have composer installed, you can use the docker version: `docker run --rm -it -v $PWD:/app composer run-script check-style`

### Writing Tests

[](#writing-tests)

All tests are located in the *tests* folder in the namespace `BigCommerce\Tests`. The namespace should match the class being tested after this, e.g. `BigCommerce\Tests\Api\Carts` for testing `BigCommerce\ApiV3\Api\Carts\CartsApi`.

Responses can be mocked using the `BigCommerceApiTest::setReturnData()` function then you can inspect the request that was made with `BigCommerceApiTest::getLastRequest()`. Response JSON files are stored in *tests/BigCommerce/responses*.

Full Documentation
------------------

[](#full-documentation)

If you would like to have full class documentation, run `docker run --rm -v /path/to/vendor/aligent/bigcommerce-api:/data phpdoc/phpdoc:3 run -d /data/src -t /data/docs --defaultpackagename BigCommerce --visibility public`

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community27

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 88.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Recently: every ~74 days

Total

48

Last Release

1145d ago

Major Versions

v0.12.0 → v1.0.02020-12-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2562970d9b77564454ead1236c1db5ddedb44198bb00925b614418c4105f541?d=identicon)[aligent](/maintainers/aligent)

---

Top Contributors

[![jswift](https://avatars.githubusercontent.com/u/641652?v=4)](https://github.com/jswift "jswift (554 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (56 commits)")[![AymericPlanche](https://avatars.githubusercontent.com/u/927944?v=4)](https://github.com/AymericPlanche "AymericPlanche (4 commits)")[![jracek-chl](https://avatars.githubusercontent.com/u/110138006?v=4)](https://github.com/jracek-chl "jracek-chl (3 commits)")[![hellboy1975](https://avatars.githubusercontent.com/u/68774?v=4)](https://github.com/hellboy1975 "hellboy1975 (3 commits)")[![Zigr1](https://avatars.githubusercontent.com/u/36465099?v=4)](https://github.com/Zigr1 "Zigr1 (2 commits)")[![joelreeds](https://avatars.githubusercontent.com/u/48527572?v=4)](https://github.com/joelreeds "joelreeds (2 commits)")[![kishan93](https://avatars.githubusercontent.com/u/5936307?v=4)](https://github.com/kishan93 "kishan93 (1 commits)")[![Mosnar](https://avatars.githubusercontent.com/u/3810939?v=4)](https://github.com/Mosnar "Mosnar (1 commits)")[![simpleapps-io](https://avatars.githubusercontent.com/u/66499666?v=4)](https://github.com/simpleapps-io "simpleapps-io (1 commits)")[![Yorg-Pixeo](https://avatars.githubusercontent.com/u/196175509?v=4)](https://github.com/Yorg-Pixeo "Yorg-Pixeo (1 commits)")[![aligent-skumar](https://avatars.githubusercontent.com/u/61396369?v=4)](https://github.com/aligent-skumar "aligent-skumar (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/aligent-bigcommerce-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/aligent-bigcommerce-api-client/health.svg)](https://phpackages.com/packages/aligent-bigcommerce-api-client)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
