yvz/bigcommerce-api-service 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yvz/bigcommerce-api-service

最新稳定版本:1.0.0

Composer 安装命令:

composer require yvz/bigcommerce-api-service

包简介

BigCommerce API Service for Laravel applications

README 文档

README

The Bigcommerce API Service package allows you to interact with Bigcommerce's API for managing catalog resources such as products, categories, brands, variants, custom fields, and more. This package for multi-tenant systems.

Installation

Install the package via Composer:

composer require yvz/bigcommerce-api-service

Usage

You can dynamically access all the available resources through the BigcommerceApiService class. Example:

use Yvz\BigcommerceApiService\Services\BigcommerceApiService;

$service = new BigcommerceApiService('storeHash', 'accessToken');

// Example: Fetch product list
$products = $service->products->list(['limit' => 10]);

Available Resources and Methods

The following resources are available, each with its corresponding methods for interacting with the Bigcommerce API.

1. CategoryResource

Methods:

  • list(array $parameters, bool $includeHeaders = true): array
    Retrieves a list of categories.

    • Example:
      $categories = $service->categories->list(['limit' => 10]);
  • show(int $id, array $parameters = [], bool $includeHeaders = true): array
    Retrieves details of a specific category.

    • Example:
      $category = $service->categories->show(123);

2. BrandResource

Methods:

  • list(array $parameters, bool $includeHeaders = true): array
    Retrieves a list of brands.

    • Example:
      $brands = $service->brands->list(['limit' => 5]);
  • show(int $brandId, array $parameters = [], bool $includeHeaders = true): array
    Retrieves details of a specific brand.

    • Example:
      $brand = $service->brands->show(45);

3. ProductResource

Methods:

  • list(array $parameters, bool $includeHeaders = true): array
    Retrieves a list of products.

    • Example:
      $products = $service->products->list(['limit' => 20]);
  • show(int $id, array $parameters = [], bool $includeHeaders = true): array
    Retrieves details of a specific product.

    • Example:
      $product = $service->products->show(567);

4. ProductVariantResource

Methods:

  • list(int $productId, array $parameters, bool $includeHeaders = true): array
    Retrieves a list of variants for a given product.

    • Example:
      $variants = $service->variants->list(1234, []);
  • batchList(array $parameters, bool $includeHeaders = true): array
    Retrieves a batch list of variants.

    • Example:
      $batchVariants = $service->variants->batchList([]);
  • show(int $productId, int $variantId, array $parameters = [], bool $includeHeaders = true): array
    Retrieves details of a specific variant.

    • Example:
      $variant = $service->variants->show(1234, 5678);

5. ProductModifierResource

Methods:

  • list(int $productId, array $parameters, bool $includeHeaders = true): array
    Retrieves the list of modifiers for a product.

    • Example:
      $modifiers = $service->modifiers->list(1234, []);
  • show(int $productId, int $modifierId, array $parameters = [], bool $includeHeaders = true): array
    Retrieves details of a specific modifier.

    • Example:
      $modifier = $service->modifiers->show(1234, 4321);

6. ProductCustomFieldResource

Methods:

  • list(int $productId, array $parameters, bool $includeHeaders = true): array
    Retrieves the list of custom fields for a product.

    • Example:
      $customFields = $service->customFields->list(1234, []);
  • show(int $productId, int $customFieldId, array $parameters = [], bool $includeHeaders = true): array
    Retrieves details of a specific custom field.

    • Example:
      $customField = $service->customFields->show(1234, 5678);

7. ProductMetafieldResource

Methods:

  • list(int $productId, array $parameters = [], bool $includeHeaders = true): array
    Retrieves all metafields for a product.
  • batchList(array $parameters = [], bool $includeHeaders = true): array
    Retrieves a batch list of metafields.
  • create(int $productId, array $parameters = [], bool $includeHeaders = true): array
    Creates a metafield for a product.
  • update(int $productId, int $metafieldId, array $parameters = [], bool $includeHeaders = true): array
    Updates a metafield for a product.
  • delete(int $productId, int $metafieldId, bool $includeHeaders = true): array
    Deletes a metafield for a product.

8. ProductVariantMetafieldResource

Methods:

  • list(int $productId, int $variantId, array $parameters = [], bool $includeHeaders = true): array
    Retrieves all metafields for a product variant.

    • Example:
      $metafields = $service->variantMetafields->list(1234, 5678, []);
  • batchList(array $parameters = [], bool $includeHeaders = true): array
    Retrieves a batch list of metafields.

  • show(int $productId, int $variantId, int $metafieldId, array $parameters = [], bool $includeHeaders = true): array
    Retrieves details of a specific metafield.

  • create(int $productId, int $variantId, array $parameters = [], bool $includeHeaders = true): array
    Creates a new metafield for a variant.

  • update(int $productId, int $variantId, int $metafieldId, array $parameters = [], bool $includeHeaders = true): array
    Updates an existing metafield for a variant.

  • delete(int $productId, int $variantId, int $metafieldId, bool $includeHeaders = true): array
    Deletes a metafield for a variant.

Response Format

All requests return a structured data array:

Success:

[
    'status' => true,        // true if request was successful
    'statusCode' => 200,     // HTTP response code
    'data' => [...],         // Response data
    'headers' => [...]       // Headers in the response
]

Error:

[
    'status' => false,       
    'statusCode' => 400,     
    'error_bag' => 'Error message...', 
    'headers' => [...]
]

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-20